Repository navigation
Add fileid preview endpoint - #7902
Conversation
|
@MorrisJobke this is what you had in mind right? |
| ['name' => 'Preview#getPreview', 'url' => '/core/preview', 'verb' => 'GET'], | ||
| ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'], | ||
| ['name' => 'Preview#getPreviewByPath', 'url' => '/core/preview.png', 'verb' => 'GET'], | ||
| ['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview.fileid', 'verb' => 'GET'], |
There was a problem hiding this comment.
/core/preview.fileid.png for our friend IE11? 😉 (not tested but just a wild guess)
There was a problem hiding this comment.
No IE11 works fine if you set the proper content type ;)
Yes 👍 |
|
And the unit tests fail. |
Codecov Report
@@ Coverage Diff @@
## master #7902 +/- ##
============================================
+ Coverage 51.23% 51.39% +0.15%
- Complexity 24853 24856 +3
============================================
Files 1598 1590 -8
Lines 94876 94568 -308
Branches 1376 1376
============================================
- Hits 48611 48601 -10
+ Misses 46265 45967 -298 |
|
And now they pass :) |
|
|
||
| if (typeof urlSpec.fileId !== 'undefined') { | ||
| delete urlSpec.file; | ||
| return OC.generateUrl('/core/preview.fileid?') + $.param(urlSpec); |
There was a problem hiding this comment.
can we have a valid file ending please? Helps in some browsers when you right-click save stuff.
There was a problem hiding this comment.
No we can't. becaus I don't know what type of file we'll server png or jpeg. So whichever one we chose it can lie.
There was a problem hiding this comment.
But that is also the behaviour of the /core/preview.png route, right?
There was a problem hiding this comment.
Yes. But that is not an argument ;-)
There was a problem hiding this comment.
Ok, just seemed odd to me that we then remove the preview route without the .png extension which would actually be the one that has a more correct 😉
There was a problem hiding this comment.
There was a problem hiding this comment.
yeah that route didn't do anything... was just a leftover. Because we map function to route. so it was overwritten :P
There was a problem hiding this comment.
Ok, fine by me, just seemed a bit inconsistent 🙈
There was a problem hiding this comment.
Aaah you mean like that. well sure we can also move this route to just /preview would be fine by me
Signed-off-by: Roeland Jago Douma <[email protected]>
This makes sure the preview is cached even after rename! yay! Signed-off-by: Roeland Jago Douma <[email protected]>
Fixes #7700
File paths can change. The fileid is stable.
To observer watch your network console:
🎈