geminabox 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/geminabox/hostess.rb +4 -1
- data/lib/geminabox/incoming_gem.rb +5 -1
- data/lib/geminabox/server.rb +6 -2
- data/lib/geminabox/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a7be0ebee3d899057907a90084837978a25915b3a82683e8ea74e0d1227d3125
|
|
4
|
+
data.tar.gz: 12a531294faf2cb0745b44ac1c9191a759f0d82ba05acabfa33d05637e4d551f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 149594466d61a7637ec9e308aba64b4b076588f9e01523fac0cded7465f7bfeb257a9ea6b051e17a408580775f64210201b87d1fc5a81bb1d9555b28caab978d
|
|
7
|
+
data.tar.gz: c9ff3b58f3c76ca47330a9949ad6d01c98a88a5970d06eb06c0e0c417122315e3fadefc9b69e6e777c5b4adfc5a53b6675b014a53c2d9849cf455a547051fe6d
|
data/lib/geminabox/hostess.rb
CHANGED
|
@@ -9,7 +9,10 @@ module Geminabox
|
|
|
9
9
|
|
|
10
10
|
def serve
|
|
11
11
|
headers["Cache-Control"] = 'no-transform'
|
|
12
|
-
|
|
12
|
+
path = File.expand_path(File.join(Geminabox.data, *request.path_info))
|
|
13
|
+
# Rack::Protection normally strips ".." first; this holds without it.
|
|
14
|
+
halt 404 unless path.start_with?(File.expand_path(Geminabox.data) + File::SEPARATOR)
|
|
15
|
+
send_file(path, :type => response['Content-Type'])
|
|
13
16
|
end
|
|
14
17
|
|
|
15
18
|
%w[/specs.4.8.gz
|
|
@@ -26,8 +26,12 @@ module Geminabox
|
|
|
26
26
|
File.open(@tempfile.path, "rb")
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
+
# spec comes from the uploaded archive and RubyGems does not validate it on
|
|
30
|
+
# read, so the name must be checked before it becomes part of a path.
|
|
29
31
|
def valid?
|
|
30
|
-
spec && spec.name && spec.version
|
|
32
|
+
spec && spec.name && spec.version &&
|
|
33
|
+
spec.name.match?(Gem::Specification::VALID_NAME_PATTERN) &&
|
|
34
|
+
File.basename(name) == name
|
|
31
35
|
rescue Gem::Package::Error
|
|
32
36
|
false
|
|
33
37
|
end
|
data/lib/geminabox/server.rb
CHANGED
|
@@ -174,8 +174,9 @@ module Geminabox
|
|
|
174
174
|
error_response(403, 'Gem deletion is disabled - see https://github.com/geminabox/geminabox/issues/115')
|
|
175
175
|
end
|
|
176
176
|
|
|
177
|
+
path = file_path
|
|
177
178
|
serialize_update do
|
|
178
|
-
File.delete
|
|
179
|
+
File.delete path if File.exist? path
|
|
179
180
|
self.class.reindex(:force_rebuild)
|
|
180
181
|
redirect url("/")
|
|
181
182
|
end
|
|
@@ -309,7 +310,10 @@ HTML
|
|
|
309
310
|
end
|
|
310
311
|
|
|
311
312
|
def file_path
|
|
312
|
-
File.expand_path(File.join(Geminabox.data, *request.path_info))
|
|
313
|
+
path = File.expand_path(File.join(Geminabox.data, *request.path_info))
|
|
314
|
+
# Rack::Protection normally strips ".." first; this holds without it.
|
|
315
|
+
halt 404 unless path.start_with?(File.expand_path(Geminabox.data) + File::SEPARATOR)
|
|
316
|
+
path
|
|
313
317
|
end
|
|
314
318
|
|
|
315
319
|
def dependency_cache
|
data/lib/geminabox/version.rb
CHANGED