guillotine 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/guillotine.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'guillotine'
16
- s.version = '1.0.7'
16
+ s.version = '1.0.8'
17
17
  s.date = '2011-11-11'
18
18
  s.rubyforge_project = 'guillotine'
19
19
 
data/lib/guillotine.rb CHANGED
@@ -3,7 +3,7 @@ require 'digest/md5'
3
3
  require 'addressable/uri'
4
4
 
5
5
  module Guillotine
6
- VERSION = "1.0.7"
6
+ VERSION = "1.0.8"
7
7
 
8
8
  dir = File.expand_path '../guillotine', __FILE__
9
9
  autoload :App, "#{dir}/app"
@@ -112,13 +112,18 @@ module Guillotine
112
112
  # Fixes a bug in Guillotine 1.0.2 where the content type on url objects
113
113
  # was not being set. The ruby Riak::Client defaults to JSON, so
114
114
  # strings were being saved as "somecode", which is unparseable by JSON.
115
- def fix_url_object(obj)
116
- if obj.content_type != PLAIN
115
+ def fix_url_object(obj, data = nil)
116
+ if data
117
117
  obj.content_type = PLAIN
118
- obj.data = JSON.parse(%({"data":#{obj.raw_data}}))['data']
118
+ obj.data = data
119
119
  obj.store
120
+ return obj
121
+ end
122
+ case obj.content_type
123
+ when /json/ then fix_url_object(obj, JSON.parse(%({"data":#{obj.raw_data}}))['data'])
124
+ when PLAIN then obj
125
+ else fix_url_object(obj, obj.data) # old values had the right data but the content type was application/x-www-form-urlencoded
120
126
  end
121
- obj
122
127
  end
123
128
 
124
129
  def url_key(url)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guillotine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-11 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
- requirement: &70284745825400 !ruby/object:Gem::Requirement
16
+ requirement: &70215141118220 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.2.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70284745825400
24
+ version_requirements: *70215141118220
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: addressable
27
- requirement: &70284745824840 !ruby/object:Gem::Requirement
27
+ requirement: &70215141117700 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.2.6
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70284745824840
35
+ version_requirements: *70215141117700
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rack-test
38
- requirement: &70284745824400 !ruby/object:Gem::Requirement
38
+ requirement: &70215141117280 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70284745824400
46
+ version_requirements: *70215141117280
47
47
  description: Adaptable private URL shortener
48
48
  email: technoweenie@gmail.com
49
49
  executables: []