mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
remove extra purge cache for html file create
This commit is contained in:
parent
b0bb40fe23
commit
01aab733bb
3 changed files with 15 additions and 2 deletions
|
@ -14,7 +14,7 @@ post '/site_files/create' do
|
|||
require_login
|
||||
@errors = []
|
||||
|
||||
filename = params[:pagefilename] || params[:filename]
|
||||
filename = params[:filename]
|
||||
|
||||
filename.gsub!(/[^a-zA-Z0-9_\-.]/, '')
|
||||
|
||||
|
|
|
@ -850,7 +850,6 @@ class Site < Sequel::Model
|
|||
tmpfile.write render_template('index.erb')
|
||||
tmpfile.close
|
||||
store_files [{filename: path, tempfile: tmpfile}]
|
||||
purge_cache path
|
||||
tmpfile.unlink
|
||||
end
|
||||
|
||||
|
|
|
@ -24,6 +24,20 @@ describe 'site_files' do
|
|||
ScreenshotWorker.jobs.clear
|
||||
end
|
||||
|
||||
describe 'install' do
|
||||
it 'installs new html file' do
|
||||
post '/site_files/create', {filename: 'test.html', csrf_token: 'abcd'}, {'rack.session' => { 'id' => @site.id, '_csrf_token' => 'abcd' }}
|
||||
_(last_response.body).must_equal ""
|
||||
_(last_response.status).must_equal 302
|
||||
_(last_response.headers['Location']).must_match /dashboard/
|
||||
testfile = @site.site_files_dataset.where(path: 'test.html').first
|
||||
_(testfile).wont_equal nil
|
||||
_(File.exists?(@site.files_path('test.html'))).must_equal true
|
||||
_(PurgeCacheWorker.jobs.length).must_equal 1
|
||||
_(PurgeCacheWorker.jobs.first['args'].last).must_equal '/test'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'rename' do
|
||||
before do
|
||||
PurgeCacheWorker.jobs.clear
|
||||
|
|
Loading…
Add table
Reference in a new issue