Commit Graph

207 Commits (master)

Author SHA1 Message Date
Andy Scherzinger dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 week ago
Joas Schilling 4286660983
fix: Extend SVG reference check
Signed-off-by: Joas Schilling <coding@schilljs.com>
2 weeks ago
Joas Schilling bd6989d365
Merge pull request #44710 from nextcloud/pulsejet/imagick-check-type
fix(preview): check mime type before processing with Imagick
2 weeks ago
Côme Chilliet 672923f0a6
fix: Fix newly spotted psalm issues, add exhaustive typed magic properties for LDAP classes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 month ago
Varun Patil 4ab40e355f fix(preview): check mime type before processing with Imagick
Signed-off-by: Varun Patil <varunpatil@ucla.edu>
2 months ago
Côme Chilliet ec5133b739 fix: Apply new coding standard to all files
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2 months ago
Git'Fellow 6f4d0fe79c Lower failed movie preview to info
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
4 months ago
Arthur Schiwon c4f4c5a3fb
Merge pull request #41067 from Murena-SAS/preview-folder-deletes
Fix for previews not being generated sometimes
5 months ago
Joas Schilling aa5f037af7
chore: apply changes from Nextcloud coding standards 1.1.1
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
6 months ago
Christoph Wurst c9dc377ebc
Merge pull request #41395 from nextcloud/hello-emf
feat: add preview provider for emf files based on office
7 months ago
Git'Fellow ef5f7d0a90 Us strpos() only
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
7 months ago
Git'Fellow 53b84732a3 Check for open_basedir before reading /proc
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
7 months ago
Daniel Kesselberg 475dd60354
fix: use png as preview right away
The initial office preview implementation converted an office document with LibreOffice to PDF, used ImageMagick to extract the first page as JPEG, and passed it OC_Image.

https://github.com/nextcloud/server/pull/10198 changed the implementation to use PNG rather than PDF. OC_Image can use a PNG as a preview right away, so the ImageMagick step is unnecessary.

The registration code was updated to not ask ImageMagick if PDF is supported, as PDFs are no longer used to create office document previews.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
7 months ago
Daniel Kesselberg b5241d5220
feat: allow multiple libreoffice invocations
LibreOffice only allows one invocation per user profile.[^1]

The office provider set the user profile to /tmp/owncloud-instanceid and therefore only one invocation per instance is allowed. This was introduced a while ago, yet it's unclear if this was intentionally or just a side effect.[^2]

The limitation on one invocation leads to the situation that the preview generation only works for a couple of files if you upload a whole folder of emf or word files.

This commit removes the limitation by using a new user profile for each preview. That's done by using instance id plus file id as postfix for getTemporaryFolder.

This has some drawbacks:

- Overload protection: If you upload 100 emf files, you may end up with 100 LibreOffice invocations. Though, you can use preview_concurrency_new to limit the number of previews that can be generated concurrently when php-sysvsem is available.
- New profile: I assume it takes a few bits to generate a fresh LibreOffice user profile. It appears that there is no way to ask LibreOffice to not create a profile and just work with the defaults. The profile will be cleaned after use by our temp manager.
- Remove the configuration option preview_office_cl_parameters:  This is not strictly necessary yet, but if you set the configuration option, the generated path for the user profile is also missing. The configuration option is not well documented (e.g., it's unclear that the last option needs to be --outdir) and actually, there should be no reason to change it after all.

[^1]: https://wiki.documentfoundation.org/UserProfile
[^2]: https://github.com/owncloud/core/pull/9784

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
7 months ago
Daniel Kesselberg aa48a5f94f
feat: add preview provider for emf files based on office
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
7 months ago
Simon L b681cf735a address review
Signed-off-by: Simon L <szaimen@e.mail.de>
7 months ago
Simon L 531f5d1e4f fix semaphore guarding
Signed-off-by: Simon L <szaimen@e.mail.de>
7 months ago
Git'Fellow d1169af129 Use \Throwable instead
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
7 months ago
Git'Fellow 624986a6d5 Catch Imaginary processing errors
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
7 months ago
Git'Fellow 974e86e618 Don't pass invalid streams to Imaginary
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>

Update Imaginary.php

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>

Update Imaginary.php

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
7 months ago
Akhil 1d767ebff5
Check if the node has a null ID before deleting in preview watcher
Signed-off-by: Akhil <akhil@e.email>
7 months ago
Daniel Hansson da2aad598e
also remove function
Signed-off-by: Daniel Hansson <mailto@danielhansson.nu>
8 months ago
Daniel Hansson b2d105e7ec
Generate all preview sizes for Imaginary
A follow up on https://github.com/nextcloud/server/pull/40670

Based on discussions here: https://github.com/nextcloud/server/issues/38911#issuecomment-1741819188

This fixes the case were not all previews are generated, for example in the activity view: https://github.com/nextcloud/server/issues/38911#issuecomment-1738886106



Signed-off-by: Daniel Hansson <mailto@danielhansson.nu>
8 months ago
JanisPlayer 80abec668b
feat: Imaginary WebP support
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
9 months ago
John Molakvoæ 52590a762f
feat(files): add uploader
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
9 months ago
John Molakvoæ 28725c46a8
feat: redirect to the mime icon if no preview available
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
10 months ago
Simon L 46dfb84bca log imaginary errors as info to not spam the server logs
Signed-off-by: Simon L <szaimen@e.mail.de>
10 months ago
Joas Schilling 4f7de8ed60
fix!: Remove legacy event dispatching Symfony's GenericEvent
Signed-off-by: Joas Schilling <coding@schilljs.com>
10 months ago
Christoph Wurst 14719110b9 chore: Replace \OC::$server->query with \OCP\Server::get in /lib
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
11 months ago
Daniel Kesselberg 3757f390c3
feat: replace id3parser with mp3info
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
11 months ago
Daniel Kesselberg 440f882322
feat: add width, height, crop and mode to BeforePreviewFetchedEvent
user_usage_report keeps a counter for files read.

The app uses

- OC_Filesystem::read hook
- Event listener (the legacy one) for IPreview::EVENT

Request for previews do not trigger the hook, hence the additional event listener.
The thumbnails for a list or grid view should not count, so we need the width and height.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
11 months ago
Robin Appelman 9f1d497a0b
Merge pull request #38261 from fsamapoor/replace_strpos_calls_in_lib_private
Refactors "strpos" calls in  lib/private to improve code readability.
1 year ago
Daniel Kesselberg 0670ae607b
fix: catch errors in id3parser library
We use a forked version of getID3 to read embedded images from mp3 files to use them as previews.

If the library is unable to extract a image or fails on something different we should handle it properly.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
1 year ago
JanisPlayer c71a3065a7 Allow to specify an imaginary key
Signed-off-by: JanisPlayer <54918417+JanisPlayer@users.noreply.github.com>
1 year ago
Simon L 6608f84a46
Merge pull request #36692 from nextcloud/throw-exception-to-avoid-division-by-zero
fix(preview-generator): Throw exception before dividing by zero when generating previews
1 year ago
Faraz Samapoor e7cc7653b8 Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
1 year ago
Simon L d55a7c619d Fix typos in lib/public subdirectory
Found via `codespell -q 3 -S l10n -L jus ./lib/public`

Signed-off-by: luz paz <luzpaz@github.com>

Update lib/public/Accounts/IAccount.php

Signed-off-by: luz paz <luzpaz@github.com>

Signed-off-by: Simon L <szaimen@e.mail.de>
Co-Authored-By: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
1 year ago
Simon L 527de8ac9d
Merge pull request #37148 from nextcloud/enh/noid/increase-imaginary-timeouts
increase imaginary timeouts as for big files the processing could take very long
1 year ago
Côme Chilliet b294edad80
Merge branch 'master' into enh/type-iconfig-getter-calls
Signed-off-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
1 year ago
Simon L 8508865eaf
Merge pull request #37772 from nextcloud/enh/30986/follow-up
Prevent the OpenDocument preview generator from trying to open empty files
1 year ago
Simon L 800f40b71c fix php-lint
Signed-off-by: Simon L <szaimen@e.mail.de>
1 year ago
Glandos e542e60dbc try to make linters happy
Signed-off-by: Glandos <bugs-github@antipoul.fr>
1 year ago
Glandos 3440387f0f gather code from small and max preview
use directory listing in both functions to gain 25% speed on run where
every preview already exist.

Signed-off-by: Glandos <bugs-github@antipoul.fr>
1 year ago
Glandos 24c121347a Revert 0e49b40
Signed-off-by: Glandos <bugs-github@antipoul.fr>
1 year ago
Glandos 06a7e90383 improve parameter doc
Signed-off-by: Glandos <bugs-github@antipoul.fr>
1 year ago
Glandos 4954bead1d Ensure max preview image is not null
Signed-off-by: Glandos <bugs-github@antipoul.fr>
1 year ago
Glandos b6c65fee2a php-cs-fix
Signed-off-by: Glandos <bugs-github@antipoul.fr>
1 year ago
Glandos 9b4d5146d5 List preview directory only once
getCachedPreview used to call `getFile`, and this calls `getDirectoryListing` (or underlying function that list directory) to find the file. This was done for every preview spec.
Now, this is done only once at the beginning of the loop, and the array is just iterated when needed to find the correct entry.

Signed-off-by: Glandos <bugs-github@antipoul.fr>
1 year ago
Claus-Justus Heine 456679c6fb Update lib/private/Preview/Bundled.php
Co-authored-by: Carl Schwan <carl@carlschwan.eu>
1 year ago
Claus-Justus Heine b3d8363327 Prevent the OpenDocument preview generator from trying to open empty files.
Rationale: does not make sense, and triggers a deprecation error in
\ZipArchive.

Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
1 year ago