fixed file renaming issues with page_file_dir. This will only work with appropriate changes in gollum-lib

This commit is contained in:
mpnowacki
2015-10-04 11:34:25 +02:00
parent ab42c0c0df
commit 3811fb46b3
+1 -1
View File
@@ -179,7 +179,7 @@ module Precious
halt 500 unless tempfile.is_a? Tempfile
# Remove page file dir prefix from upload path if necessary -- committer handles this itself
dir = wiki.per_page_uploads ? params[:upload_dest].match(/^(#{wiki.page_file_dir}\/+)?(.*)/)[2] : 'uploads'
dir = wiki.per_page_uploads ? params[:upload_dest] : ::File.join([wiki.page_file_dir, 'uploads'].compact)
ext = ::File.extname(fullname)
format = ext.split('.').last || 'txt'
filename = ::File.basename(fullname, ext)