nextcloud / nextcloud/richdocuments
Watermarking can break previews in text documents
Open
Nobody has claimed this yet.
bug
feature: previews and thumbnails
feature: secure view
- Dominant language
- JavaScript
- Stars
- 453
- Forks
- 147
- Avg merge
- 14h 54m
- Merged PRs (30d)
- 83
Description
{
"reqId": "LN1S03oRKp1PAwIbWjRm",
"level": 3,
"time": "2024-07-15T08:31:35+00:00",
"remoteAddr": "77.9.65.243",
"user": "admin",
"app": "text",
"method": "GET",
"url": "/apps/text/image?documentId=49&sessionId=466&sessionToken=%2BrcE2mRd9QinmxNlseV4WuyEbwsowFmEdV3hHpMo2OpnvGseSI%2Fp%2B2i%2Bz4SnV%2FBn&imageFileName=Gorilla.jpg",
"message": "getImageFile error",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:128.0) Gecko/20100101 Firefox/128.0",
"version": "29.0.3.4",
"exception": {
"Exception": "OCP\\Files\\NotFoundException",
"Message": "",
"Code": 0,
"Trace": [
{
"file": "/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php",
"line": 86,
"function": "handle",
"class": "OCA\\Richdocuments\\Listener\\BeforeFetchPreviewListener",
"type": "->",
"args": [
[
"OCP\\Preview\\BeforePreviewFetchedEvent"
]
]
},
{
"file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
"line": 230,
"function": "__invoke",
"class": "OC\\EventDispatcher\\ServiceEventListener",
"type": "->",
"args": [
[
"OCP\\Preview\\BeforePreviewFetchedEvent"
],
"OCP\\Preview\\BeforePreviewFetchedEvent",
[
"Symfony\\Component\\EventDispatcher\\EventDispatcher"
]
]
},
{
"file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
"line": 59,
"function": "callListeners",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->",
"args": [
[
[
"Closure"
],
[
"Closure"
]
],
"OCP\\Preview\\BeforePreviewFetchedEvent",
[
"OCP\\Preview\\BeforePreviewFetchedEvent"
]
]
},
{
"file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
"line": 86,
"function": "dispatch",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->",
"args": [
[
"OCP\\Preview\\BeforePreviewFetchedEvent"
],
"OCP\\Preview\\BeforePreviewFetchedEvent"
]
},
{
"file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
"line": 98,
"function": "dispatch",
"class": "OC\\EventDispatcher\\EventDispatcher",
"type": "->",
"args": [
"OCP\\Preview\\BeforePreviewFetchedEvent",
[
"OCP\\Preview\\BeforePreviewFetchedEvent"
]
]
},
{
"file": "/var/www/html/lib/private/Preview/Generator.php",
"line": 101,
"function": "dispatchTyped",
"class": "OC\\EventDispatcher\\EventDispatcher",
"type": "->",
"args": [
[
"OCP\\Preview\\BeforePreviewFetchedEvent"
]
]
},
{
"file": "/var/www/html/lib/private/PreviewManager.php",
"line": 187,
"function": "getPreview",
"class": "OC\\Preview\\Generator",
"type": "->",
"args": [
[
"OC\\Files\\Node\\File"
],
1024,
1024,
false,
"fill",
null
]
},
{
"file": "/var/www/html/apps/text/lib/Service/AttachmentService.php",
"line": 103,
"function": "getPreview",
"class": "OC\\PreviewManager",
"type": "->",
"args": [
[
"OC\\Files\\Node\\File"
],
1024,
1024
]
},
{
"file": "/var/www/html/apps/text/lib/Service/AttachmentService.php",
"line": 68,
"function": "getImageFileContent",
"class": "OCA\\Text\\Service\\AttachmentService",
"type": "->",
"args": [
"Gorilla.jpg",
[
"OC\\Files\\Node\\File"
],
false
]
},
{
"file": "/var/www/html/apps/text/lib/Controller/AttachmentController.php",
"line": 205,
"function": "getImageFile",
"class": "OCA\\Text\\Service\\AttachmentService",
"type": "->",
"args": [
49,
"Gorilla.jpg",
"admin",
false
]
},
{
"file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
"line": 232,
"function": "getImageFile",
"class": "OCA\\Text\\Controller\\AttachmentController",
"type": "->",
"args": [
"Gorilla.jpg",
null,
0
]
},
{
"file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
"line": 138,
"function": "executeController",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
[
"OCA\\Text\\Controller\\AttachmentController"
],
"getImageFile"
]
},
{
"file": "/var/www/html/lib/private/AppFramework/App.php",
"line": 184,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
[
"OCA\\Text\\Controller\\AttachmentController"
],
"getImageFile"
]
},
{
"file": "/var/www/html/lib/private/Route/Router.php",
"line": 338,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::",
"args": [
"OCA\\Text\\Controller\\AttachmentController",
"getImageFile",
[
"OC\\AppFramework\\DependencyInjection\\DIContainer"
],
[
"text.attachment.getimagefile"
]
]
},
{
"file": "/var/www/html/lib/base.php",
"line": 1050,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->",
"args": [
"/apps/text/image"
]
},
{
"file": "/var/www/html/index.php",
"line": 49,
"function": "handleRequest",
"class": "OC",
"type": "::",
"args": []
}
],
"File": "/var/www/html/custom_apps/richdocuments/lib/Listener/BeforeFetchPreviewListener.php",
"Line": 80,
"message": "getImageFile error",
"exception": [],
"CustomMessage": "getImageFile error"
},
"id": "6694de711611a"
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with apps/text/lib/Service/AttachmentService.php and apps/text/lib/Controller/AttachmentController.php, following the getImageFile path shown in the trace. Then inspect richdocuments/lib/Listener/BeforeFetchPreviewListener.php around line 80 and reproduce the text-document preview failure; done means previews no longer fail when watermarking is involved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100