Skip to content

Commit 1d97d0f

Browse files
committed
Remove the deprecated routes for PDF icons/thumbnails
This reverts commit ab50d83.
1 parent ab50d83 commit 1d97d0f

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
@@ -875,18 +875,6 @@ By default the `content-disposition` will be `inline`, but it will be
875875
GET /files/download?Path=/Documents/hello.txt&Dl=1 HTTP/1.1
876876
```
877877

878-
### GET /files/:file-id/icon/:secret
879-
880-
Get an image that shows the first page of a PDF in a small resolution (96x96).
881-
882-
**Note:** this route is deprecated, you should use thumbnails instead.
883-
884-
### GET /files/:file-id/preview/:secret
885-
886-
Get an image that shows the first page of a PDF (at most 1080x1920).
887-
888-
**Note:** this route is deprecated, you should use thumbnails instead.
889-
890878
### GET /files/:file-id/thumbnails/:secret/:format
891879

892880
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
@@ -977,48 +977,6 @@ func HeadDirOrFile(c echo.Context) error {
977977
return nil
978978
}
979979

980-
// IconHandler serves icon for the PDFs.
981-
func IconHandler(c echo.Context) error {
982-
instance := middlewares.GetInstance(c)
983-
984-
secret := c.Param("secret")
985-
fileID, err := vfs.GetStore().GetThumb(instance, secret)
986-
if err != nil {
987-
return WrapVfsError(err)
988-
}
989-
if c.Param("file-id") != fileID {
990-
return jsonapi.NewError(http.StatusBadRequest, "Wrong download token")
991-
}
992-
993-
doc, err := instance.VFS().FileByID(fileID)
994-
if err != nil {
995-
return WrapVfsError(err)
996-
}
997-
998-
return vfs.ServePDFIcon(c.Response(), c.Request(), instance.VFS(), doc)
999-
}
1000-
1001-
// PreviewHandler serves preview images for the PDFs.
1002-
func PreviewHandler(c echo.Context) error {
1003-
instance := middlewares.GetInstance(c)
1004-
1005-
secret := c.Param("secret")
1006-
fileID, err := vfs.GetStore().GetThumb(instance, secret)
1007-
if err != nil {
1008-
return WrapVfsError(err)
1009-
}
1010-
if c.Param("file-id") != fileID {
1011-
return jsonapi.NewError(http.StatusBadRequest, "Wrong download token")
1012-
}
1013-
1014-
doc, err := instance.VFS().FileByID(fileID)
1015-
if err != nil {
1016-
return WrapVfsError(err)
1017-
}
1018-
1019-
return vfs.ServePDFPreview(c.Response(), c.Request(), instance.VFS(), doc)
1020-
}
1021-
1022980
// ThumbnailHandler serves thumbnails of the images/photos
1023981
func ThumbnailHandler(c echo.Context) error {
1024982
instance := middlewares.GetInstance(c)
@@ -1906,8 +1864,6 @@ func Routes(router *echo.Group) {
19061864
router.POST("/upload/metadata", UploadMetadataHandler)
19071865
router.POST("/:file-id/copy", FileCopyHandler)
19081866

1909-
router.GET("/:file-id/icon/:secret", IconHandler)
1910-
router.GET("/:file-id/preview/:secret", PreviewHandler)
19111867
router.GET("/:file-id/thumbnails/:secret/:format", ThumbnailHandler)
19121868

19131869
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-03-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)