el_finder 1.0.14 → 1.0.15

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.
@@ -409,7 +409,7 @@ module ElFinder
409
409
  else
410
410
  begin
411
411
  target.unlink
412
- if (thumbnail = thumbnail_for(target)).file?
412
+ if @options[:thumbs] && (thumbnail = thumbnail_for(target)).file?
413
413
  thumbnail.unlink
414
414
  end
415
415
  rescue
@@ -493,7 +493,7 @@ module ElFinder
493
493
  def tree_for(root)
494
494
  root.children.
495
495
  select{ |child| child.directory? }.
496
- reject{ |child| child.to_s == @thumb_directory.to_s }.
496
+ reject{ |child| @options[:thumbs] && child.to_s == @thumb_directory.to_s }.
497
497
  sort_by{|e| e.basename.to_s.downcase}.
498
498
  map { |child|
499
499
  {:name => child.basename.to_s,
@@ -1,3 +1,3 @@
1
1
  module ElFinder
2
- VERSION = '1.0.14'
2
+ VERSION = '1.0.15'
3
3
  end
@@ -106,6 +106,20 @@ class TestElFinderThumbs < Test::Unit::TestCase
106
106
  assert !File.exist?(elfinder_thumb)
107
107
  end
108
108
 
109
+ def test_thumbnail_removal_not_attempted_when_thumbs_not_enabled_and_image_removed
110
+ @elfinder.options = { :thumbs => false }
111
+ pjkh_thumb = File.join(@vroot, '.thumbs', "#{@elfinder.to_hash(ElFinder::Pathname.new(@vroot, 'pjkh.png'))}.png")
112
+ elfinder_thumb = File.join(@vroot, '.thumbs', "#{@elfinder.to_hash(ElFinder::Pathname.new(@vroot, 'elfinder.png'))}.png")
113
+ Dir.mkdir(File.join(@vroot, '.thumbs'))
114
+ FileUtils.touch pjkh_thumb
115
+ FileUtils.touch elfinder_thumb
116
+
117
+ h, r = @elfinder.run(:cmd => 'open', :init => 'true', :target => '')
118
+ h, r = @elfinder.run(:cmd => 'rm', :targets => r[:cdc].select{|e| e[:mime] =~ /image/}.map{|e| e[:hash]})
119
+
120
+ assert_nil r[:error]
121
+ end
122
+
109
123
  def test_open_response_contains_tmb_details_if_thumbs_exist
110
124
  @elfinder.options = { :thumbs => true }
111
125
  h, r = @elfinder.run(:cmd => 'open', :init => 'true', :target => '')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: el_finder
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 14
10
- version: 1.0.14
9
+ - 15
10
+ version: 1.0.15
11
11
  platform: ruby
12
12
  authors:
13
13
  - Philip Hallstrom
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-25 00:00:00 -07:00
18
+ date: 2011-05-02 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency