Skip to content
Snippets Groups Projects
Commit 5df5dbb8 authored by Steffen Schulze's avatar Steffen Schulze
Browse files

backup link modification for upload/download

parent 83cb296f
No related branches found
No related tags found
No related merge requests found
Pipeline #51585 passed with warnings with stages
in 3 minutes and 8 seconds
......@@ -263,12 +263,14 @@ func GenerateBackupLink(ctx *gin.Context, e common.Env) (any, error) {
name := ctx.Query("name")
var bid string
var dbOperation func(*gorm.DB, string, string, string, []byte) error
var prefix = "xfscpcmbackup"
if mode == common.ModeUpload {
bid = e.GetRandomId()
dbOperation = model.CreateBackupDBEntry
prefix = prefix + "upload"
} else if mode == common.ModeDownload {
bid = ctx.Query("bindingId")
prefix = prefix + "download"
if bid == "" {
return nil, common.ErrorResponseBadRequest(ctx, "queryParam `bindingId` required", nil)
}
......@@ -280,7 +282,7 @@ func GenerateBackupLink(ctx *gin.Context, e common.Env) (any, error) {
}
path := getOneTimePath(ctx, bid, user)
res := BackupLinkOutput{Path: "xfscpcmbackup://" + path.String(), TTL: config.ServerConfiguration.BackupLinkTTL.Seconds()}
res := BackupLinkOutput{Path: prefix + "://" + path.String(), TTL: config.ServerConfiguration.BackupLinkTTL.Seconds()}
return res, dbOperation(e.GetDB(), bid, user.ID(), name, []byte{})
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment