Skip to content

Commit 5d3b3ec

Browse files
committed
Remove the deprecated routes for PDF icons/thumbnails
This reverts commit ab50d83.
1 parent 3b9b252 commit 5d3b3ec

File tree

7 files changed

+6
-244
lines changed

7 files changed

+6
-244
lines changed

docs/files.md

-12
Original file line numberDiff line numberDiff line change
@@ -935,18 +935,6 @@ By default the `content-disposition` will be `inline`, but it will be
935935
GET /files/download?Path=/Documents/hello.txt&Dl=1 HTTP/1.1
936936
```
937937

938-
### GET /files/:file-id/icon/:secret
939-
940-
Get an image that shows the first page of a PDF in a small resolution (96x96).
941-
942-
**Note:** this route is deprecated, you should use thumbnails instead.
943-
944-
### GET /files/:file-id/preview/:secret
945-
946-
Get an image that shows the first page of a PDF (at most 1080x1920).
947-
948-
**Note:** this route is deprecated, you should use thumbnails instead.
949-
950938
### GET /files/:file-id/thumbnails/:secret/:format
951939

952940
Get a thumbnail of a file (for an image & pdf only). `:format` can be `tiny` (96x96)

docs/important-changes.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
This section will list important changes to the stack or its usage, and migration procedures if any is needed.
66

7+
## April 2024: Routes for PDF
8+
9+
The deprecated routes for getting the icon or preview of a PDF file has been removed.
10+
11+
You should use the thumbnails instead.
12+
713
## December 2023: Iterations for PBKDF2 increased
814

915
We have increased the number of PBKDF2 iterations for new users to 650_000, and removed the exception for Edge as it now supports PBKDF2 via the subtle crypto API.

model/vfs/pdf.go

-178
This file was deleted.

pkg/jsonapi/data.go

-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ type LinksList struct {
3939
Small string `json:"small,omitempty"`
4040
Medium string `json:"medium,omitempty"`
4141
Large string `json:"large,omitempty"`
42-
// Preview for PDF
43-
Preview string `json:"preview,omitempty"`
4442
}
4543

4644
// Relationship is a resource linkage, as described in JSON-API

web/files/files.go

-44
Original file line numberDiff line numberDiff line change
@@ -992,48 +992,6 @@ func HeadDirOrFile(c echo.Context) error {
992992
return nil
993993
}
994994

995-
// IconHandler serves icon for the PDFs.
996-
func IconHandler(c echo.Context) error {
997-
instance := middlewares.GetInstance(c)
998-
999-
secret := c.Param("secret")
1000-
fileID, err := vfs.GetStore().GetThumb(instance, secret)
1001-
if err != nil {
1002-
return WrapVfsError(err)
1003-
}
1004-
if c.Param("file-id") != fileID {
1005-
return jsonapi.NewError(http.StatusBadRequest, "Wrong download token")
1006-
}
1007-
1008-
doc, err := instance.VFS().FileByID(fileID)
1009-
if err != nil {
1010-
return WrapVfsError(err)
1011-
}
1012-
1013-
return vfs.ServePDFIcon(c.Response(), c.Request(), instance.VFS(), doc)
1014-
}
1015-
1016-
// PreviewHandler serves preview images for the PDFs.
1017-
func PreviewHandler(c echo.Context) error {
1018-
instance := middlewares.GetInstance(c)
1019-
1020-
secret := c.Param("secret")
1021-
fileID, err := vfs.GetStore().GetThumb(instance, secret)
1022-
if err != nil {
1023-
return WrapVfsError(err)
1024-
}
1025-
if c.Param("file-id") != fileID {
1026-
return jsonapi.NewError(http.StatusBadRequest, "Wrong download token")
1027-
}
1028-
1029-
doc, err := instance.VFS().FileByID(fileID)
1030-
if err != nil {
1031-
return WrapVfsError(err)
1032-
}
1033-
1034-
return vfs.ServePDFPreview(c.Response(), c.Request(), instance.VFS(), doc)
1035-
}
1036-
1037995
// ThumbnailHandler serves thumbnails of the images/photos
1038996
func ThumbnailHandler(c echo.Context) error {
1039997
instance := middlewares.GetInstance(c)
@@ -1922,8 +1880,6 @@ func Routes(router *echo.Group) {
19221880
router.POST("/upload/metadata", UploadMetadataHandler)
19231881
router.POST("/:file-id/copy", FileCopyHandler)
19241882

1925-
router.GET("/:file-id/icon/:secret", IconHandler)
1926-
router.GET("/:file-id/preview/:secret", PreviewHandler)
19271883
router.GET("/:file-id/thumbnails/:secret/:format", ThumbnailHandler)
19281884

19291885
router.POST("/archive", ArchiveDownloadCreateHandler)

web/files/files_test.go

-4
Original file line numberDiff line numberDiff line change
@@ -3614,10 +3614,6 @@ func TestFiles(t *testing.T) {
36143614
data.ValueEqual("id", parentID)
36153615
data.Value("attributes").Object().ValueEqual("size", "90")
36163616
})
3617-
3618-
t.Run("DeprecatePreviewAndIcon", func(t *testing.T) {
3619-
testutils.TODO(t, "2024-05-01", "Remove the deprecated preview and icon for PDF files")
3620-
})
36213617
}
36223618

36233619
func readFile(fs vfs.VFS, name string) ([]byte, error) {

web/files/paginated.go

-4
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,6 @@ func (f *file) Links() *jsonapi.LinksList {
389389
links.Small = "/files/" + f.doc.DocID + "/thumbnails/" + f.thumbSecret + "/small"
390390
links.Medium = "/files/" + f.doc.DocID + "/thumbnails/" + f.thumbSecret + "/medium"
391391
links.Large = "/files/" + f.doc.DocID + "/thumbnails/" + f.thumbSecret + "/large"
392-
if f.doc.Class == "pdf" {
393-
links.Icon = "/files/" + f.doc.DocID + "/icon/" + f.thumbSecret
394-
links.Preview = "/files/" + f.doc.DocID + "/preview/" + f.thumbSecret
395-
}
396392
}
397393
}
398394
return &links

0 commit comments

Comments
 (0)