Skip to content

Always try and show pre rendered preview - #20451

Merged
MorrisJobke merged 2 commits into
nextcloud:masterfrom
exussum12:AllowPreviewWhenGeneratorHasBeenRemoved
Aug 13, 2020
Merged

Always try and show pre rendered preview#20451
MorrisJobke merged 2 commits into
nextcloud:masterfrom
exussum12:AllowPreviewWhenGeneratorHasBeenRemoved

Conversation

@exussum12

Copy link
Copy Markdown
Contributor

Currently if the following situation happens

Server generates preview
Server has command removed which allows a preview to be shown
Client asks for preview, gets a 404 error when preview exists
(Mime checked before preview)

This happens more often with documents, or video as the commands are not
native PHP, they require a binary on the server.

After the fix the following would happen

Server generates preview
Server has command removed which allows a preview to be shown
Client asks for preview, gets preview which has been generated
(Mime checked after preview)

This would also allow offline generation (for example a docker image
containing the extra binaries), allowing a reduction in attack surface
of the instance serving the preview data.

@gary-kimgary-kim added 3. to review Waiting for reviews enhancement labels Apr 13, 2020
@gary-kimgary-kim added this to the Nextcloud 19 milestone Apr 13, 2020
@rullzerrullzer mentioned this pull request Apr 13, 2020
59 tasks

@rullzerrullzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by me.

@rullzer

Copy link
Copy Markdown
Member

@exussum12 seems the test fail. Mind to have a look?

This was referenced Apr 15, 2020
@exussum12
exussum12force-pushed the AllowPreviewWhenGeneratorHasBeenRemoved branch from 5c6ea6d to 4ab6721CompareApril 18, 2020 19:09
@rullzerrullzer mentioned this pull request Apr 23, 2020
11 tasks
@juliusknorr

Copy link
Copy Markdown
Member

There still seems to be an issue with one test:

There was 1 failure:
1) Test\Preview\GeneratorTest::testInvalidMimeType
Failed asserting that exception of type "TypeError" matches expected exception "OCP\Files\NotFoundException". Message was: "Argument 1 passed to Mock_IAppData_5c52be9a::getFolder() must be of the type string, null given, called in /drone/src/lib/private/Preview/Generator.php on line 460" at
/drone/src/lib/private/Preview/Generator.php:460
/drone/src/lib/private/Preview/Generator.php:129
/drone/src/lib/private/Preview/Generator.php:106
/drone/src/tests/lib/Preview/GeneratorTest.php:278
.

@juliusknorrjuliusknorr added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Apr 24, 2020
@MorrisJobkeMorrisJobke mentioned this pull request Aug 11, 2020
57 tasks
Currently if the following situation happens
Server generates preview
Server has command removed which allows a preview to be shown
Client asks for preview, gets a 404 error when preview exists
(Mime checked before preview)
This happens more often with documents, or video as the commands are not
native PHP, they require a binary on the server.
After the fix the following would happen
Server generates preview
Server has command removed which allows a preview to be shown
Client asks for preview, gets preview which has been generated
(Mime checked after preview)
This would also allow offline generation (for example a docker image
containing the extra binaries), allowing a reduction in attack surface
of the instance serving the preview data.
Signed-off-by: Scott Dutton <scott@exussum.co.uk>
@MorrisJobke
MorrisJobkeforce-pushed the AllowPreviewWhenGeneratorHasBeenRemoved branch from 4ab6721 to b12a390CompareAugust 13, 2020 20:50
@MorrisJobke

Copy link
Copy Markdown
Member

Rebased to check the tests again.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
@MorrisJobke

Copy link
Copy Markdown
Member

I fixed the test and added one specifically for this new use case.

@MorrisJobkeMorrisJobke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me 👍

@MorrisJobkeMorrisJobke added 4. to release Ready to be released and/or waiting for tests to finish and removed 2. developing Work in progress labels Aug 13, 2020
@MorrisJobke

Copy link
Copy Markdown
Member

CI also likes it -> merge \o/

@MorrisJobke
MorrisJobke merged commit 75c659c into nextcloud:masterAug 13, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to releaseReady to be released and/or waiting for tests to finishenhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@exussum12@rullzer@juliusknorr@MorrisJobke@icewind1991@gary-kim