Subject: | Character set interpretation broken |
The code in Net::DAV::Server performs a conversion to make all calls to
Filesys::Virtual::* manipulate filenames as octet strings and not UTF-8.
Since all the DAV clients I have tested (Windows Explorer, OSX Finder,
DAVExplorer) appear to want URI encoded UTF-8 data, and perl's internal
data format is UTF-8, I have found the encode_utf8 and decode_utf8 calls
in the code to be completely unwanted.
Subject: | nds.patch |
=== local/Net-DAV-Server/lib/Net/DAV/Server.pm
==================================================================
--- local/Net-DAV-Server/lib/Net/DAV/Server.pm (revision 3998)
+++ local/Net-DAV-Server/lib/Net/DAV/Server.pm (local)
@@ -2,7 +2,6 @@
use strict;
use warnings;
use File::Slurp;
-use Encode;
use File::Find::Rule::Filesys::Virtual;
use HTTP::Date qw(time2str time2isoz);
use HTTP::Headers;
@@ -45,7 +44,7 @@
my $fs = $self->filesys || die 'Boom';
my $method = $request->method;
- my $path = decode_utf8 uri_unescape $request->uri->path;
+ my $path = uri_unescape $request->uri->path;
if (!defined $response) {
$response = HTTP::Response->new;
@@ -80,7 +79,7 @@
sub head {
my ($self, $request, $response) = @_;
- my $path = decode_utf8 uri_unescape $request->uri->path;
+ my $path = uri_unescape $request->uri->path;
my $fs = $self->filesys;
if ($fs->test("f", $path) && $fs->test("r", $path)) {
@@ -100,7 +99,7 @@
sub get {
my ($self, $request, $response) = @_;
- my $path = decode_utf8 uri_unescape $request->uri->path;
+ my $path = uri_unescape $request->uri->path;
my $fs = $self->filesys;
if ($fs->test('f', $path) && $fs->test('r', $path)) {
@@ -133,7 +132,7 @@
sub put {
my ($self, $request, $response) = @_;
- my $path = decode_utf8 uri_unescape $request->uri->path;
+ my $path = uri_unescape $request->uri->path;
my $fs = $self->filesys;
$response = HTTP::Response->new(201, "CREATED", $response->headers);
@@ -156,7 +155,7 @@
sub delete {
my ($self, $request, $response) = @_;
- my $path = decode_utf8 uri_unescape $request->uri->path;
+ my $path = uri_unescape $request->uri->path;
my $fs = $self->filesys;
if ($request->uri->fragment) {
@@ -204,7 +203,7 @@
sub copy {
my ($self, $request, $response) = @_;
- my $path = decode_utf8 uri_unescape $request->uri->path;
+ my $path = uri_unescape $request->uri->path;
my $fs = $self->filesys;
my $destination = $request->header('Destination');
@@ -266,7 +265,7 @@
sub copy_file {
my ($self, $request, $response) = @_;
- my $path = decode_utf8 uri_unescape $request->uri->path;
+ my $path = uri_unescape $request->uri->path;
my $fs = $self->filesys;
my $destination = $request->header('Destination');
@@ -325,7 +324,7 @@
sub lock {
my ($self, $request, $response) = @_;
- my $path = decode_utf8 uri_unescape $request->uri->path;
+ my $path = uri_unescape $request->uri->path;
my $fs = $self->filesys;
$fs->lock($path);
@@ -335,7 +334,7 @@
sub unlock {
my ($self, $request, $response) = @_;
- my $path = decode_utf8 uri_unescape $request->uri->path;
+ my $path = uri_unescape $request->uri->path;
my $fs = $self->filesys;
$fs->unlock($path);
@@ -345,7 +344,7 @@
sub mkcol {
my ($self, $request, $response) = @_;
- my $path = decode_utf8 uri_unescape $request->uri->path;
+ my $path = uri_unescape $request->uri->path;
my $fs = $self->filesys;
if ($request->content) {
@@ -367,7 +366,7 @@
sub propfind {
my ($self, $request, $response) = @_;
- my $path = decode_utf8 uri_unescape $request->uri->path;
+ my $path = uri_unescape $request->uri->path;
my $fs = $self->filesys;
my $depth = $request->header('Depth');
@@ -444,7 +443,7 @@
my $href = $doc->createElement('D:href');
$href->appendText(
File::Spec->catdir(
- map { uri_escape encode_utf8 $_} File::Spec->splitdir($path)
+ map { uri_escape $_} File::Spec->splitdir($path)
)
);
$resp->addChild($href);