pulse-downloader 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pulse/downloader/file_downloader.rb +32 -3
- data/lib/pulse/downloader/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: 17c6b467560188e6ccbf9549fe0be00188726daf87352d295788ccbbb986ead3
|
4
|
+
data.tar.gz: a88019ce7c0708767b8c76bb5796ec34950f1ddf02cd7f2e8b83cb09126bcbb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b96d3ec2c08d342d4884c8d413d5133d1a71776f12e9dfc8c12829db9f1f0fc02f784f58f07481692f13b8d7a1a2dce66bd7e2c049077d1a337a676876a15c5b
|
7
|
+
data.tar.gz: b60ca5f1204ae2efd86c31c946dbcbff3d02c4279d83fd8f36c07d9909e4103db1df98b9009b5305b8271c3ba6c6fe7bda4daf708bb0505f15aab316e08af0a5
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module Pulse
|
2
2
|
module Downloader
|
3
3
|
module FileDownloader
|
4
|
-
require 'uri'
|
5
|
-
|
6
4
|
# save_path and verify_ssl are defined in client.rb
|
7
5
|
def download(file_path, progress_bar=nil)
|
8
6
|
raise "save_path is undefined" if save_data && save_path == ''
|
@@ -10,7 +8,7 @@ module Pulse
|
|
10
8
|
|
11
9
|
@start_time = get_micro_second_time
|
12
10
|
|
13
|
-
file_data = HTTParty.get(
|
11
|
+
file_data = HTTParty.get(escape(compute_file_link(file_path)), verify: verify_ssl)
|
14
12
|
|
15
13
|
@end_time = get_micro_second_time
|
16
14
|
|
@@ -68,6 +66,37 @@ module Pulse
|
|
68
66
|
def section?(file_path)
|
69
67
|
file_path[0] == '#'
|
70
68
|
end
|
69
|
+
|
70
|
+
def escape(str)
|
71
|
+
str.gsub("Space", "%20")
|
72
|
+
str.gsub("$", "\%24")
|
73
|
+
str.gsub("&", "\%26")
|
74
|
+
str.gsub("`", "\%60")
|
75
|
+
str.gsub(":", "\%3A")
|
76
|
+
str.gsub("<", "\%3C")
|
77
|
+
str.gsub(">", "\%3E")
|
78
|
+
str.gsub("[", "\%5B")
|
79
|
+
str.gsub("]", "\%5D")
|
80
|
+
str.gsub("{", "\%7B")
|
81
|
+
str.gsub("}", "\%7D")
|
82
|
+
str.gsub("“", "\%22")
|
83
|
+
str.gsub('"', "\%22")
|
84
|
+
str.gsub("+", "\%2B")
|
85
|
+
str.gsub("#", "\%23")
|
86
|
+
str.gsub("\%", "\%25")
|
87
|
+
str.gsub("@", "\%40")
|
88
|
+
str.gsub("/", "\%2F")
|
89
|
+
str.gsub(";", "\%3B")
|
90
|
+
str.gsub("=", "\%3D")
|
91
|
+
str.gsub("?", "\%3F")
|
92
|
+
str.gsub("\\", "\%5C")
|
93
|
+
str.gsub("^", "\%5E")
|
94
|
+
str.gsub("|", "\%7C")
|
95
|
+
str.gsub("~", "\%7E")
|
96
|
+
str.gsub("‘", "\%27")
|
97
|
+
str.gsub(",", "\%2C")
|
98
|
+
str
|
99
|
+
end
|
71
100
|
end
|
72
101
|
end
|
73
102
|
end
|