Skip to content

Instantly share code, notes, and snippets.

@pragtich
Created February 8, 2013 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pragtich/4739071 to your computer and use it in GitHub Desktop.
Save pragtich/4739071 to your computer and use it in GitHub Desktop.
diff --git a/_plugins/postfiles.rb b/_plugins/postfiles.rb
index 08c60bf..ce79b55 100644
--- a/_plugins/postfiles.rb
+++ b/_plugins/postfiles.rb
@@ -20,13 +20,13 @@ def generate(site)
site.posts.each do |post|
# Go back to the single-file post name
- postfile_id = post.id.gsub(/[\s\w\/]*(\d{4})\/(\d\d)\/(\d\d)\/(.*)/, '\1-\2-\3-\4')
+ postfile_id = post.id.gsub(/[\s\w\/%]*(\d{4})\/(\d\d)\/(\d\d)\/(.*)/, '\1-\2-\3-\4')
# Get the directory that files from this post would be in
postfile_dir = File.join(site.config['source'], '_postfiles', postfile_id)
# Add a static file entry for each postfile, if any
Dir[File.join(postfile_dir, '/*')].each do |pf|
- site.static_files << PostFile.new(site, postfile_dir, post.url, File.basename(pf))
+ site.static_files << PostFile.new(site, postfile_dir, CGI.unescape(post.url), File.basename(pf))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment