Handle OctoPrint upload of files having Unicode characters in filename or path. #2827
This commit is contained in:
parent
56b993bb89
commit
854be6a186
1 changed files with 4 additions and 2 deletions
|
@ -1230,13 +1230,15 @@ sub send_gcode {
|
||||||
my $ua = LWP::UserAgent->new;
|
my $ua = LWP::UserAgent->new;
|
||||||
$ua->timeout(180);
|
$ua->timeout(180);
|
||||||
|
|
||||||
|
my $path = Slic3r::encode_path($self->{send_gcode_file});
|
||||||
my $res = $ua->post(
|
my $res = $ua->post(
|
||||||
"http://" . $self->{config}->octoprint_host . "/api/files/local",
|
"http://" . $self->{config}->octoprint_host . "/api/files/local",
|
||||||
Content_Type => 'form-data',
|
Content_Type => 'form-data',
|
||||||
'X-Api-Key' => $self->{config}->octoprint_apikey,
|
'X-Api-Key' => $self->{config}->octoprint_apikey,
|
||||||
Content => [
|
Content => [
|
||||||
# OctoPrint doesn't like Windows paths
|
# OctoPrint doesn't like Windows paths so we use basename()
|
||||||
file => [ $self->{send_gcode_file}, basename($self->{send_gcode_file}) ],
|
# Also, since we need to read from filesystem we process it through encode_path()
|
||||||
|
file => [ $path, basename($path) ],
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue