pushfile 0.1.1 → 0.1.2

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: 73dd773d95177422a2a3bb46bc78f65d9613a6bb
4
- data.tar.gz: 65aa642ab4fd573a22b66baa134e8bcd9248476f
3
+ metadata.gz: b640190bce1efb45bbf88de4cad12f28d615a176
4
+ data.tar.gz: f252b01349bdddc9cbba41a6d70fd56047df1acf
5
5
  SHA512:
6
- metadata.gz: 735ce4ca526df140d03bc863518d5c5e935af7dcb23cb0b51fdc1cb6c0f7eb2aa8d2c2462725954159479ea2038172805e71eb895a708bac0ca3c2a0e4b2df6e
7
- data.tar.gz: 70d0645ab396c1b2502afe57d4fbc31dd1202a06ae6b944098f484d3d0a545744180cef1c6cb1702685253c91163e80f7a80ac12e9e883307d02e8111296fe6d
6
+ metadata.gz: 7e6db594a7f266de5084682de0715501eeb03ca1305a2c7c0e1b89fb04aa2cfe1d7631ebe4c8bf2ae50f144304dbd3eac11bf387ad694297f7e68ef0169de2ec
7
+ data.tar.gz: dcef9f976bc09062d367f46c50165c382786133a8352e72ce2c99fcd91e0176cc68f9c3b9a5e1776f8c2ed63c43389c55127b29c5854f11d3f68c0bb2a6d8128
@@ -1,3 +1,7 @@
1
+ **Version 0.1.2** - *2017-03-09*
2
+
3
+ - Error handling for empty name in URL upload
4
+
1
5
  **Version 0.1.1** - *2017-02-15*
2
6
 
3
7
  - Fixed resize config lookup
@@ -16,7 +16,6 @@ module Pushfile
16
16
  # Do Froala or Dropzone file uploads
17
17
  elsif @options[:file] || @options[:datafile]
18
18
  file_upload
19
-
20
19
  end
21
20
  end
22
21
 
@@ -52,11 +51,13 @@ module Pushfile
52
51
  def url_upload
53
52
  url = @options[:url].strip
54
53
 
54
+ content = RestClient.get(url) rescue nil
55
+
55
56
  file = Tempfile.new('tmp').tap do |file|
56
57
  file.binmode # must be in binary mode
57
- file.write RestClient.get(url)
58
+ file.write(content)
58
59
  file.rewind
59
- end
60
+ end if content
60
61
 
61
62
  # Extract the file name from the URL
62
63
  filename = url.split('/').last
@@ -51,6 +51,10 @@ module Pushfile
51
51
  # Create upload
52
52
  def create
53
53
  @file = @data.is_a?(String) ? File.open(@data) : @data[:tempfile]
54
+
55
+ # Return error if no file
56
+ return (@status = {:error => 'upload_file_not_found'}) unless @file
57
+
54
58
  @name = filename(@data.is_a?(String) ? @data : @data[:filename])
55
59
 
56
60
  # Check if it's more than max or return error
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'pushfile'
3
- s.version = '0.1.1'
4
- s.date = '2017-02-15'
3
+ s.version = '0.1.2'
4
+ s.date = '2017-03-09'
5
5
  s.summary = "Pushfile Cloud File Uploader"
6
6
  s.description = "Upload files to Rackspace Cloud or Amazon S3 by URL or file with automatic image resizing."
7
7
  s.authors = ["Fugroup Limited"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushfile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fugroup Limited
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-15 00:00:00.000000000 Z
11
+ date: 2017-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  requirements: []
193
193
  rubyforge_project:
194
- rubygems_version: 2.6.8
194
+ rubygems_version: 2.6.10
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: Pushfile Cloud File Uploader