Fixed updating and display of storage usage when an uploaded file is deleted.
This commit is contained in:
parent
e0c65a6ac4
commit
6a5481f7d6
|
@ -491,11 +491,10 @@ class Files( object ):
|
||||||
if not db_file or not self.__users.check_access( user_id, db_file.notebook_id, read_write = True ):
|
if not db_file or not self.__users.check_access( user_id, db_file.notebook_id, read_write = True ):
|
||||||
raise Access_error()
|
raise Access_error()
|
||||||
|
|
||||||
user = self.__database.load( User, user_id )
|
self.__database.execute( db_file.sql_delete(), commit = False )
|
||||||
if not user:
|
user = self.__users.update_storage( user_id, commit = False )
|
||||||
raise Access_error()
|
self.__database.commit()
|
||||||
|
|
||||||
self.__database.execute( db_file.sql_delete() )
|
|
||||||
os.remove( Upload_file.make_server_filename( file_id ) )
|
os.remove( Upload_file.make_server_filename( file_id ) )
|
||||||
|
|
||||||
return dict(
|
return dict(
|
||||||
|
|
|
@ -2356,12 +2356,10 @@ Upload_pulldown.prototype.shutdown = function ( force, display_quota_error ) {
|
||||||
// if there's an upload in progress and the force flag is not set, then bail without performing a
|
// if there's an upload in progress and the force flag is not set, then bail without performing a
|
||||||
// shutdown
|
// shutdown
|
||||||
if ( this.uploading ) {
|
if ( this.uploading ) {
|
||||||
if ( force ) {
|
if ( !force )
|
||||||
if ( !display_quota_error )
|
|
||||||
this.wiki.display_message( "The file upload has been cancelled." )
|
|
||||||
} else {
|
|
||||||
return;
|
return;
|
||||||
}
|
if ( !display_quota_error )
|
||||||
|
this.wiki.display_message( "The file upload has been cancelled." )
|
||||||
}
|
}
|
||||||
|
|
||||||
Pulldown.prototype.shutdown.call( this );
|
Pulldown.prototype.shutdown.call( this );
|
||||||
|
|
Reference in New Issue