Fixed hotlink not being generated for uploads through API with unlimited storage time

This commit is contained in:
Marc Ole Bulling
2022-06-11 17:35:21 +02:00
parent b1b38ba160
commit 803016af3c
+8 -1
View File
@@ -132,7 +132,14 @@ func GetHotlink(id string) (string, bool) {
// SaveHotlink stores the hotlink associated with the file in the bitcaskDb
func SaveHotlink(file models.File) {
err := bitcaskDb.PutWithTTL([]byte(prefixHotlink+file.HotlinkId), []byte(file.Id), expiryToDuration(file))
var err error
if file.UnlimitedTime {
err = bitcaskDb.Put([]byte(prefixHotlink+file.HotlinkId), []byte(file.Id))
} else {
err = bitcaskDb.PutWithTTL([]byte(prefixHotlink+file.HotlinkId), []byte(file.Id), expiryToDuration(file))
}
helper.Check(err)
err = bitcaskDb.Sync()
helper.Check(err)