Skip to content

Commit

Permalink
Set a limit on the maximum length of a post file_name.
Browse files Browse the repository at this point in the history
  • Loading branch information
tamouse committed Jan 15, 2014
1 parent 3e381c9 commit 2c75d47
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,3 +4,4 @@ planet.yml
*.gem
*.gempsec
.gs
.bundle/
39 changes: 13 additions & 26 deletions Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
planet (0.4.0)
planet (0.5.2)
box
feedzirra
gli
Expand All @@ -10,34 +10,21 @@ PATH
GEM
remote: http://rubygems.org/
specs:
activesupport (3.1.10)
multi_json (>= 1.0, < 1.3)
box (0.1.1)
builder (3.1.4)
curb (0.7.18)
feedzirra (0.1.3)
activesupport (~> 3.1.1)
builder (>= 2.1.2)
curb (~> 0.7.15)
i18n (>= 0.5.0)
loofah (~> 1.2.0)
nokogiri (>= 1.4.4)
rake (>= 0.8.7)
rdoc (~> 3.8)
sax-machine (~> 0.1.0)
gli (2.5.3)
i18n (0.6.1)
json (1.7.6)
curb (0.8.5)
feedzirra (0.7.0)
curb (~> 0.8.1)
loofah (~> 1.2.1)
sax-machine (~> 0.2.1)
gli (2.8.1)
loofah (1.2.1)
nokogiri (>= 1.4.4)
multi_json (1.2.0)
mustache (0.99.4)
nokogiri (1.5.6)
rake (10.0.3)
rdoc (3.12)
json (~> 1.4)
sax-machine (0.1.0)
nokogiri (> 0.0.0)
mini_portile (0.5.2)
mustache (0.99.5)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
sax-machine (0.2.1)
nokogiri (~> 1.6.0)

PLATFORMS
ruby
Expand Down
2 changes: 1 addition & 1 deletion lib/planet/post.rb
Expand Up @@ -55,7 +55,7 @@ def file_name
name_date = date ? date.strftime('%Y-%m-%d') : nil
name_title = title.downcase.scan(/\w+/).join('-')

[name_date, name_title].join('-')
[name_date, name_title].join('-')[0..59] # can return a file name that is too long, so truncate here to 60 chars
end

end

0 comments on commit 2c75d47

Please sign in to comment.