asset_cloud 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c73b8628c09c25c2e05eae7b097b38a55a40175a
4
- data.tar.gz: b78f3c69d1bf5346d88bf6c3a2608e2c92cbf13a
3
+ metadata.gz: 2e9519f3cbd8f6ae164aafbbb96052e36eddf225
4
+ data.tar.gz: 887d20cd493e498d371e51e827118daa19a01f0e
5
5
  SHA512:
6
- metadata.gz: eaa3b2f1e39aefa77383c50e9d3248d97d8df7f02fd7b229747c346f12b56b8f36a907e570c8b80cc7364f79fedd61527e0b0f092947898073dca045a108dabd
7
- data.tar.gz: 24eab9467aaa4243b98c82350a504ae9fc1a3b14e4ea45dc9d7002228c9f585d0b4ae1a0c0ca3efb573547277ff193d41bb92b5862a94e528245859bdcc16bf5
6
+ metadata.gz: bdaa546e8d1bd72f68b16456aa490ab15acb166c0655c8f8d78748e4ba428029af55275e3bbbfdd689d21c5f12490e793d03d86c02a6d84fffcfb750ccf2f873
7
+ data.tar.gz: 48e53d85b4d4681524d98a6701b7a2420d316d25b925f42da7d29c6dfa52c2ad7725662e457a3c384bfb2bf28b84694d7340ed95d67f1285a7652f7f2d7a9402
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
Binary file
data/History.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Asset Cloud Version History
2
2
 
3
+ ## Version 2.2.0, 2015-03-17
4
+
5
+ * Reduce the limitations on filenames so as not to catch valid filenames. (https://github.com/Shopify/asset_cloud/pull/12)
6
+
3
7
  ## Version 2.1.0, 2015-03-03
4
8
 
5
9
  * Add support for S3 assests https://github.com/Shopify/asset_cloud/pull/7
data/asset_cloud.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{asset_cloud}
5
- s.version = "2.1.0"
5
+ s.version = "2.2.0"
6
6
 
7
7
  s.authors = %w(Shopify)
8
8
  s.summary = %q{An abstraction layer around arbitrary and diverse asset stores.}
@@ -9,7 +9,25 @@ module AssetCloud
9
9
  class Base
10
10
  cattr_accessor :logger
11
11
 
12
- VALID_PATHS = /\A[a-z0-9][a-z0-9_\-\/]+([a-z0-9][\w\-\ \.\@]*\.\w{2,6})?\z/i
12
+ VALID_PATHS = /\A
13
+ (
14
+ (\w) #Filename can be a single letter or underscore
15
+ | #OR it is many and follows the below rules
16
+ (
17
+ (\.?[\w\[\]\(\)\-\@]) #It can start with a dot but it must have a following character
18
+ (
19
+ [\w\[\]\(\)\-\@] #You can have a letter without any following conditions
20
+ |
21
+ [\ ][\w\[\]\(\)\-\@\.] #If there is a space you need to have a normal letter afterward or a dot
22
+ |
23
+ [\/][\w\[\]\(\)\-\@] #If there is a slash you need to have a normal letter afterward
24
+ |
25
+ [\/][\.][\w\[\]\(\)\-\@] #Though a slash could be followed by a dot so long as there is a normal letter afterward
26
+ |
27
+ [\.]+[\w\[\]\(\)\-\@]+ #One or more dots must be followed by one (or more) normal letters
28
+ )* #Zero to many of these combinations.
29
+ )
30
+ )\z/x
13
31
  MATCH_BUCKET = /^(\w+)(\/|$)/
14
32
 
15
33
  attr_accessor :url, :root
data/spec/base_spec.rb CHANGED
@@ -42,8 +42,78 @@ describe BasicCloud do
42
42
  lambda { @fs['./test'] }.should raise_error(AssetCloud::IllegalPath)
43
43
  end
44
44
 
45
+ it "should raise error when filename has trailing period" do
46
+ lambda { @fs['test.'] }.should raise_error(AssetCloud::IllegalPath)
47
+ lambda { @fs['/test/testfile.'] }.should raise_error(AssetCloud::IllegalPath)
48
+ lambda { @fs['test/directory/.'] }.should raise_error(AssetCloud::IllegalPath)
49
+ lambda { @fs['/test/testfile .'] }.should raise_error(AssetCloud::IllegalPath)
50
+ lambda { @fs['test/directory /.'] }.should raise_error(AssetCloud::IllegalPath)
51
+ end
52
+
53
+ it "should raise error when filename ends with space" do
54
+ lambda { @fs['test '] }.should raise_error(AssetCloud::IllegalPath)
55
+ lambda { @fs['/test/testfile '] }.should raise_error(AssetCloud::IllegalPath)
56
+ lambda { @fs['test/directory/ '] }.should raise_error(AssetCloud::IllegalPath)
57
+ lambda { @fs['test. '] }.should raise_error(AssetCloud::IllegalPath)
58
+ lambda { @fs['/test/testfile. '] }.should raise_error(AssetCloud::IllegalPath)
59
+ lambda { @fs['test/directory/. '] }.should raise_error(AssetCloud::IllegalPath)
60
+ end
61
+
62
+ it "should raise error when filename ends with slash" do
63
+ lambda { @fs['test/'] }.should raise_error(AssetCloud::IllegalPath)
64
+ lambda { @fs['test/directory/'] }.should raise_error(AssetCloud::IllegalPath)
65
+ lambda { @fs['test /'] }.should raise_error(AssetCloud::IllegalPath)
66
+ lambda { @fs['/test/testfile /'] }.should raise_error(AssetCloud::IllegalPath)
67
+ lambda { @fs['test/directory//'] }.should raise_error(AssetCloud::IllegalPath)
68
+ end
69
+
70
+ it "should raise error when using with minus relative even after another directory" do
71
+ lambda { @fs['test/../test'] }.should raise_error(AssetCloud::IllegalPath)
72
+ lambda { @fs['test/../../test'] }.should raise_error(AssetCloud::IllegalPath)
73
+ lambda { @fs['test/../../../test']}.should raise_error(AssetCloud::IllegalPath)
74
+ end
75
+
76
+ it "should raise an error when using names with combinations of '.' and ' '" do
77
+ lambda { @fs['test. . . .. ... .. . '] }.should raise_error(AssetCloud::IllegalPath)
78
+ lambda { @fs['test. .'] }.should raise_error(AssetCloud::IllegalPath)
79
+ lambda { @fs['test. .test2'] }.should raise_error(AssetCloud::IllegalPath)
80
+ end
81
+
82
+ it "should allow filenames with repeating dots" do
83
+ @fs['test..jpg']
84
+ @fs['assets/T.T..jpg']
85
+ @fs['test/assets/1234123412341234_obj_description..14...58......v8...._2134123412341234.jpg']
86
+ end
87
+
88
+ it "should allow filenames with repeating underscores" do
89
+ @fs['test__jpg']
90
+ @fs['assets/T__T..jpg']
91
+ @fs['test/assets/1234123412341234_obj_description..14...58......v8...__2134123412341234.jpg']
92
+ end
93
+
94
+ it "should allow filenames with various bracket arragements" do
95
+ @fs['test[1].jpg']
96
+ @fs['test[1]']
97
+ @fs['[test].jpg']
98
+ end
99
+
100
+ it "should not raise an error when using directory names with spaces" do
101
+ @fs['files/ass ets/.DS_Store']
102
+ end
103
+
104
+ it "should not raise_error when using unusual but valid filenames" do
105
+ @fs['.DS_Store']
106
+ @fs['photograph.g']
107
+ @fs['_testfilename']
108
+ @fs['assets/.DS_Store']
109
+ @fs['assets/photograph.g']
110
+ @fs['a/_testfilename']
111
+ @fs['a']
112
+ end
113
+
45
114
  it "should allow sensible relative filenames" do
46
115
  @fs['assets/rails_logo.gif']
116
+ @fs['assets/rails_logo']
47
117
  @fs['assets/rails-2.gif']
48
118
  @fs['assets/223434.gif']
49
119
  @fs['files/1.JPG']
metadata CHANGED
@@ -1,14 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2015-03-03 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MQ8wDQYDVQQDDAZhZG1p
14
+ bnMxFzAVBgoJkiaJk/IsZAEZFgdzaG9waWZ5MRMwEQYKCZImiZPyLGQBGRYDY29t
15
+ MB4XDTE0MDUxNTIwMzM0OFoXDTE1MDUxNTIwMzM0OFowPzEPMA0GA1UEAwwGYWRt
16
+ aW5zMRcwFQYKCZImiZPyLGQBGRYHc2hvcGlmeTETMBEGCgmSJomT8ixkARkWA2Nv
17
+ bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL0/81O3e1vh5smcwp2G
18
+ MpLQ6q0kejQLa65bPYPxdzWA1SYOKyGfw+yR9LdFzsuKpwWzKq6zX35lj1IckWS4
19
+ bNBEQzxmufUxU0XPM02haFB8fOfDJzdXsWte9Ge4IFwahwn68gpMqN+BvxL+KMYz
20
+ Iut9YmN44d4LZdsENEIO5vmybuG2vYDz7R56qB0PA+Q2P2CdhymsBad2DQs69FBo
21
+ uico9V6VMYYctL9lCYdzu9IXrOYNTt88suKIVzzAlHOKeN0Ng5qdztFoTR8sfxDr
22
+ Ydg3KHl5n47wlpgd8R0f/4b5gGxW+v9pyJCgQnLlRu7DedVSvv7+GMtj3g9r3nhJ
23
+ KqECAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFI/o
24
+ maf34HXbUOQsdoLHacEKQgunMB0GA1UdEQQWMBSBEmFkbWluc0BzaG9waWZ5LmNv
25
+ bTAdBgNVHRIEFjAUgRJhZG1pbnNAc2hvcGlmeS5jb20wDQYJKoZIhvcNAQEFBQAD
26
+ ggEBADkK9aj5T0HPExsov4EoMWFnO+G7RQ28C30VAfKxnL2UxG6i4XMHVs6Xi94h
27
+ qXFw1ec9Y2eDUqaolT3bviOk9BB197+A8Vz/k7MC6ci2NE+yDDB7HAC8zU6LAx8Y
28
+ Iqvw7B/PSZ/pz4bUVFlTATif4mi1vO3lidRkdHRtM7UePSn2rUpOi0gtXBP3bLu5
29
+ YjHJN7wx5cugMEyroKITG5gL0Nxtu21qtOlHX4Hc4KdE2JqzCPOsS4zsZGhgwhPs
30
+ fl3hbtVFTqbOlwL9vy1fudXcolIE/ZTcxQ+er07ZFZdKCXayR9PPs64heamfn0fp
31
+ TConQSX2BnZdhIEYW+cKzEC/bLc=
32
+ -----END CERTIFICATE-----
33
+ date: 2015-03-17 00:00:00.000000000 Z
12
34
  dependencies:
13
35
  - !ruby/object:Gem::Dependency
14
36
  name: activesupport
metadata.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ \)I0J$n�����A}�\�2�?.Җ�3,��%�����Ϫڎ�gZW��JK_7�$jz)����l�����=j5��8�W.x�P����#��ۘ�k~
2
+ ��I���x