π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Restrict legacy upload URLs
Neeraj Gupta6b8c6e0f61d9
diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.goindex 8be1231030..caf2fa7166 100644--- a/server/cmd/museum/main.go+++ b/server/cmd/museum/main.go@@ -606,8 +606,8 @@ func main() {}pasteHandler := &api.PasteHandler{Controller: pasteCtrl}storageAPI.GET("/files/upload-eligibility", fileHandler.ValidateUploadEligibility)- storageAPI.GET("/files/upload-urls", fileHandler.GetUploadURLs)- storageAPI.GET("/files/multipart-upload-urls", fileHandler.GetMultipartUploadURLs)+ storageAPI.GET("/files/upload-urls", fileHandler.RestrictLegacyUploads, fileHandler.GetUploadURLs)+ storageAPI.GET("/files/multipart-upload-urls", fileHandler.RestrictLegacyUploads, fileHandler.GetMultipartUploadURLs)storageAPI.POST("/files/upload-url", fileHandler.GetUploadURLV2)storageAPI.POST("/files/multipart-upload-url", fileHandler.GetMultipartUploadURLV2)storageAPI.GET("/files/download/:fileID", fileHandler.Get)diff --git a/server/pkg/api/file.go b/server/pkg/api/file.goindex c06a02ed17..ec4d4b6b9a 100644--- a/server/pkg/api/file.go+++ b/server/pkg/api/file.go@@ -8,6 +8,7 @@ import ("os""strconv""strings"+ gTime "time""github.com/ente/museum/pkg/controller/file_copy""github.com/ente/museum/pkg/controller/filedata"@@ -201,6 +202,18 @@ func (h *FileHandler) GetMultipartUploadURLV2(c *gin.Context) {c.JSON(http.StatusOK, upload)}+func (h *FileHandler) RestrictLegacyUploads(c *gin.Context) {+ user, err := h.Controller.UserRepo.Get(auth.GetUserID(c.Request.Header))+ if err != nil {+ handler.Error(c, stacktrace.Propagate(err, ""))+ return+ }+ cutoff := gTime.Date(2026, gTime.April, 1, 0, 0, 0, 0, gTime.UTC).UnixMicro()+ if user.CreationTime >= cutoff || user.ID%10 == 0 {+ c.AbortWithStatusJSON(http.StatusGone, gin.H{"error": "This upload API is no longer supported. Please update your app."})+ }+}+func (h *FileHandler) Get(c *gin.Context) {userID, fileID := getUserAndFileIDs(c)url, err := h.Controller.GetFileURL(c, userID, fileID)