mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
API: Prevent file imports/uploads if there is no free storage #4266
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -49,11 +49,19 @@ func StartImport(router *gin.RouterGroup) {
|
||||
|
||||
conf := get.Config()
|
||||
|
||||
// Abort in read-only mode and/or when the import feature is disabled.
|
||||
if conf.ReadOnly() || !conf.Settings().Features.Import {
|
||||
AbortFeatureDisabled(c)
|
||||
return
|
||||
}
|
||||
|
||||
// Abort if there is not enough free storage to import new files.
|
||||
if conf.FilesQuotaReached() {
|
||||
event.AuditErr([]string{ClientIP(c), "session %s", "import files", "insufficient storage"}, s.RefID)
|
||||
Abort(c, http.StatusInsufficientStorage, i18n.ErrInsufficientStorage)
|
||||
return
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
|
||||
var frm form.ImportOptions
|
||||
|
||||
Reference in New Issue
Block a user