directory_listing 0.5.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dafec9303b09bba3b378369ea69caf916042d0d0
4
- data.tar.gz: 8c7fbc3853f6abaa6c64bd9df2267baffa94a636
3
+ metadata.gz: 3cf8138fc74458cee692795f92ea3e8436cb795e
4
+ data.tar.gz: 10a82b76d2bbdbbb7b98fb379c90c40470ee92d4
5
5
  SHA512:
6
- metadata.gz: cbb6f227915de4813952c2829d4e143a476aed24ddc1b175d015a8011a8c3feafb706681ff2843d39ccbf87c454fe1b96f8173678ffc32f37119f5893cb7bd62
7
- data.tar.gz: 2d64dd51da5c6d7e66cedc3757a5f2ebeaf956b1172f9d83c723c2c20933af347160b327ec8d233b9dc65b4dc1c634e03c062fbbfd6cce0acba4be973eca5e63
6
+ metadata.gz: 050ce306863a84e889bd0caeb1e77736d355b652302c09cd8370d8fce04051cfdc9d48e4878ded09df5079cb72c27c1c27dc903f4229a1f5cb5b4e91a9e06cc8
7
+ data.tar.gz: 23bfe4fc941b14c4952e2663493d493a3ea65fbcc1985704e41f566fb51dd889a9d548b007cf327ad58a32177d2a5740349897c9a0c0e2f1f4b0b5749b4e0e30
@@ -59,8 +59,12 @@ class Resource
59
59
  # URI.unescape seems to work best to decode uris.
60
60
 
61
61
  file = URI.unescape(file)
62
- file = file.gsub(File.extname(file), "") if @page.should_show_file_exts == false
63
- file_truncated = file.truncate(@page.filename_truncate_length, '...')
62
+ file_noext = file.gsub(File.extname(file), "") if @page.should_show_file_exts == false
63
+ if file_noext
64
+ file_truncated = file_noext.truncate(@page.filename_truncate_length, '...')
65
+ else
66
+ file_truncated = file.truncate(@page.filename_truncate_length, '...')
67
+ end
64
68
 
65
69
  ##
66
70
  # If the requested resource is in the root public directory, the link is
@@ -1,3 +1,3 @@
1
1
  module Directory_listing
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
@@ -66,7 +66,7 @@ class DirectoryListingTest < Test::Unit::TestCase
66
66
 
67
67
  def test_should_show_file_exts
68
68
  get '/should_show_file_exts'
69
- assert !(last_response.body.include?('test.txt'))
69
+ assert last_response.body.include?('<a href=\'/should_show_file_exts/test.txt\'>test</a>')
70
70
  end
71
71
 
72
72
  ##
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: directory_listing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Myers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-20 00:00:00.000000000 Z
11
+ date: 2014-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra