summaryrefslogtreecommitdiff
path: root/lib/Net/Riak/Object.pm
diff options
context:
space:
mode:
authorSimon Wistow <simon@thegestalt.org>2011-04-09 20:07:45 -0700
committerSimon Wistow <simon@thegestalt.org>2011-04-09 20:07:45 -0700
commite2d62713835e78adef15bb6d1e3db330a1cfb1bc (patch)
treeb4e21489710fec69c32b422c6b29f36951cc86a2 /lib/Net/Riak/Object.pm
parentFix remove_link (diff)
downloadnet-riak-e2d62713835e78adef15bb6d1e3db330a1cfb1bc.tar.gz
Fix issue with url encoded links
Diffstat (limited to 'lib/Net/Riak/Object.pm')
-rw-r--r--lib/Net/Riak/Object.pm21
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/Net/Riak/Object.pm b/lib/Net/Riak/Object.pm
index 1d2b56a..f40031b 100644
--- a/lib/Net/Riak/Object.pm
+++ b/lib/Net/Riak/Object.pm
@@ -64,7 +64,7 @@ sub store {
if (defined $self->key) {
push @$path, $self->key;
$method = 'PUT';
- }
+ }
my $request = $self->client->new_request($method, $path, $params);
@@ -168,13 +168,13 @@ sub populate {
shift @siblings;
$self->siblings(\@siblings);
}
-
+
if ($status == 201) {
my $location = $http_response->header('location');
my ($key) = ($location =~ m!/([^/]+)$!);
$self->key($key);
- }
-
+ }
+
if ($status == 200 || $status == 201) {
$self->content_type($http_response->content_type)
@@ -185,16 +185,21 @@ sub populate {
}
}
+sub _uri_decode {
+ my $str = shift;
+ $str =~ s/%([a-fA-F0-9]{2,2})/chr(hex($1))/eg;
+ return $str;
+}
+
sub _populate_links {
my ($self, $links) = @_;
-
for my $link (split(',', $links)) {
if ($link
=~ /\<\/([^\/]+)\/([^\/]+)\/([^\/]+)\>; ?riaktag=\"([^\']+)\"/)
{
- my $bucket = $2;
- my $key = $3;
- my $tag = $4;
+ my $bucket = _uri_decode($2);
+ my $key = _uri_decode($3);
+ my $tag = _uri_decode($4);
my $l = Net::Riak::Link->new(
bucket => Net::Riak::Bucket->new(
name => $bucket,