From 854be6a1861f109763d93974e8eef39db823ea8e Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 2 Jun 2015 17:10:06 +0200 Subject: [PATCH] Handle OctoPrint upload of files having Unicode characters in filename or path. #2827 --- lib/Slic3r/GUI/Plater.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index d48b89c3d..fd09975b5 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -1230,13 +1230,15 @@ sub send_gcode { my $ua = LWP::UserAgent->new; $ua->timeout(180); + my $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 - file => [ $self->{send_gcode_file}, basename($self->{send_gcode_file}) ], + # 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 => [ $path, basename($path) ], ], );