Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-12-21 18:56:33 +0300
committerbubnikv <bubnikv@gmail.com>2017-12-21 18:56:33 +0300
commitf5160b7a72dcb9305e6220a88092e3bd1032387e (patch)
treeb899493a87377c4ae9de17e3b68be150f5ce62f5 /lib
parent1bf67b4b62c09d06eefab368b8698c291f05afde (diff)
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/Slic3r/GUI/Plater.pm12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm
index 91905b2b6..f05ea86bf 100644
--- a/lib/Slic3r/GUI/Plater.pm
+++ b/lib/Slic3r/GUI/Plater.pm
@@ -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,
],
);