mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 09:42:36 +02:00
scrub question marks
This commit is contained in:
parent
4fe0443a10
commit
605fa2cc74
2 changed files with 9 additions and 0 deletions
|
@ -1226,6 +1226,8 @@ class Site < Sequel::Model
|
||||||
raise ArgumentError, 'invalid character for filename' if c < 32
|
raise ArgumentError, 'invalid character for filename' if c < 32
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# scrub question marks (I should probably just be erroring out for this)
|
||||||
|
clean_path.gsub!('?', '')
|
||||||
clean_path
|
clean_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -408,6 +408,13 @@ describe 'site_files' do
|
||||||
_(File.exists?(@site.files_path('te[s]t.jpg'))).must_equal true
|
_(File.exists?(@site.files_path('te[s]t.jpg'))).must_equal true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'scrubs question marks' do
|
||||||
|
uploaded_file = Rack::Test::UploadedFile.new('./tests/files/te[s]t.jpg', 'image/jpeg')
|
||||||
|
upload 'te?st.jpg' => uploaded_file
|
||||||
|
_(last_response.body).must_match /successfully uploaded/i
|
||||||
|
_(File.exists?(@site.files_path('test.jpg'))).must_equal true
|
||||||
|
end
|
||||||
|
|
||||||
it 'sets site changed to false if index is empty' do
|
it 'sets site changed to false if index is empty' do
|
||||||
uploaded_file = Rack::Test::UploadedFile.new('./tests/files/blankindex/index.html', 'text/html')
|
uploaded_file = Rack::Test::UploadedFile.new('./tests/files/blankindex/index.html', 'text/html')
|
||||||
upload 'index.html' => uploaded_file
|
upload 'index.html' => uploaded_file
|
||||||
|
|
Loading…
Add table
Reference in a new issue