Skip to content

Commit 0fba123

Browse files
committed
Fix bug where picture files where not uploaded at all when encryption and cloud storage was active as well as SaveToLocal #247
1 parent 450a25a commit 0fba123

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

internal/storage/FileServing.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,11 @@ func NewFileFromChunk(chunkId string, fileHeader chunking.FileHeader, userId int
194194
fileToMove = tempFile
195195
}
196196
processingstatus.Set(chunkId, processingstatus.StatusUploading, models.File{}, nil)
197-
err = filesystem.ActiveStorageSystem.MoveToFilesystem(fileToMove, metaData)
197+
if metaData.IsLocalStorage() {
198+
err = filesystem.GetLocal().MoveToFilesystem(fileToMove, metaData)
199+
} else {
200+
err = filesystem.ActiveStorageSystem.MoveToFilesystem(fileToMove, metaData)
201+
}
198202
if err != nil {
199203
return models.File{}, err
200204
}

internal/storage/filesystem/FileSystem.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,11 @@ func SetLocal() {
4242
ActiveStorageSystem = dataFilesystem
4343
}
4444

45+
// GetLocal gets the local filesystem, regardless of what filesystem is used by default. This is required when encrypted
46+
// pictures are stored locally instead of the cloud to support hotlinking
47+
func GetLocal() interfaces.System {
48+
return dataFilesystem
49+
}
50+
4551
// isUnitTesting is only set to true when testing, to avoid login with aws
4652
var isUnitTesting = false

0 commit comments

Comments
 (0)