Skip to content

Commit e7571cd

Browse files
committed
sanitize
1 parent ecfec13 commit e7571cd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

handler/image.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ func (i image) UploadImage(c *fiber.Ctx) error {
210210
objectName := imageName
211211
if path != "" {
212212
// Sanitize path as well
213+
path = strings.Trim(path, "/")
213214
sanitizedPath := service.SanitizeObjectName(path)
214215
objectName = sanitizedPath + "/" + imageName
215216
}
@@ -361,6 +362,7 @@ func (i image) UploadWithUrl(c *fiber.Ctx) error {
361362
objectName := randomName + "." + sanitizedExtension
362363
if req.Path != "" {
363364
// Sanitize path as well
365+
req.Path = strings.Trim(req.Path, "/")
364366
sanitizedPath := service.SanitizeObjectName(req.Path)
365367
objectName = sanitizedPath + "/" + randomName + "." + sanitizedExtension
366368
}

0 commit comments

Comments
 (0)