mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-29 19:53:44 -06:00 
			
		
		
		
	Fixed "Slic3r crashes when sending STLs with special characters to the printer"
https://github.com/prusa3d/Slic3r/issues/597 The "Send to OctoPrint" function will now send the file name encoded in UTF-8, so the file name will not get mangled. The C++ Slic3r::encode_path() function was returning a string to Perl, which was marked as UTF-8. This has been fixed, now encode_path() returns a plain Perl string. Added path_to_filename, path_to_stem, path_to_extension, path_to_parent_path Perl wrappers to boost::filesystem::path splitting functionality to be able to split UTF-8 encoded files on Windows correctly.
This commit is contained in:
		
							parent
							
								
									1bf67b4b62
								
							
						
					
					
						commit
						f5160b7a72
					
				
					 5 changed files with 113 additions and 6 deletions
				
			
		|  | @ -1460,15 +1460,19 @@ sub send_gcode { | |||
|     my $ua = LWP::UserAgent->new; | ||||
|     $ua->timeout(180); | ||||
|      | ||||
|     my $enc_path = Slic3r::encode_path($self->{send_gcode_file}); | ||||
|     my $res = $ua->post( | ||||
|         "http://" . $self->{config}->octoprint_host . "/api/files/local", | ||||
|         Content_Type => 'form-data', | ||||
|         'X-Api-Key' => $self->{config}->octoprint_apikey, | ||||
|         Content => [ | ||||
|             # OctoPrint doesn't like Windows paths so we use basename() | ||||
|             # Also, since we need to read from filesystem we process it through encode_path() | ||||
|             file => [ $enc_path, basename($enc_path) ], | ||||
|             file => [  | ||||
|                 # On Windows, the path has to be encoded in local code page for perl to be able to open it. | ||||
|                 Slic3r::encode_path($self->{send_gcode_file}), | ||||
|                 # Remove the UTF-8 flag from the perl string, so the LWP::UserAgent can insert  | ||||
|                 # the UTF-8 encoded string into the request as a byte stream. | ||||
|                 Encode::encode_utf8(Slic3r::path_to_filename($self->{send_gcode_file})) | ||||
|             ], | ||||
|             print => $self->{send_gcode_file_print} ? 1 : 0, | ||||
|         ], | ||||
|     ); | ||||
|      | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bubnikv
						bubnikv