aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Type
Commit message (Collapse)AuthorAgeFilesLines
* refactor(IMimeTypeDetector): use consistent capitalizationchore/consistent-namingFerdinand Thiessen2025-04-021-51/+52
| | | | | | | | - use consistantly `mimeType` as it is called MIME type - fix issues where implementation and interface had different parameter names (this is an issue since PHP has named parameters). Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
* fix(IMimeTypeDetector): use correct return typefix/IMimeTypeDetector-typesFerdinand Thiessen2025-03-181-2/+2
| | | | | | | | | | | | | | In PHP array keys that are integers are always kept as integer, meaning the type of the key of `$a = ["1" => "one"]` will be integer not string. While are hacks to circumvent this (case std object with string keys to an assoc. array) those hacks are performance wise awefull and also not needed as in PHP you can always access that element with `$a[1]` or `$a["1"]`. So TL;DR;: do not lie about return types. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
* fix(files): Make sure file pointer existsfilePointerCheckGit'Fellow2025-03-071-8/+8
| | | Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
* fix: psalm and OCP @since declarationsfix/mime-intJohn Molakvoæ2025-02-061-2/+2
| | | | Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de> Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
* fix: make sure we process mime extensions as stringskjnldsv2025-02-051-4/+11
| | | | Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
* chore(db): Correctly apply query typesGit'Fellow2024-10-171-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | fix: psalm fix: error fix: add batch fix: fatal error fix: add batch chore: add batch chore: add batch fix: psalm fix: typo fix: psalm fix: return bool fix: revert Manager
* style: update codestyle for coding-standard 1.2.3Daniel Kesselberg2024-08-251-3/+3
| | | | Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
* chore: Add SPDX headerAndy Scherzinger2024-05-243-79/+11
| | | | Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
* fix: Improve typing of mimetype aliasesCôme Chilliet2024-04-301-27/+14
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* refactor(mimeloader): modernize MimeTypeLoaderThomas Citharel2024-03-141-27/+15
| | | | Signed-off-by: Thomas Citharel <tcit@tcit.fr>
* chore: apply changes from Nextcloud coding standards 1.1.1Joas Schilling2023-11-231-5/+5
| | | | | Signed-off-by: Joas Schilling <coding@schilljs.com> Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
* Wrap mimetype insert and getLastInsertId in a transactionLucas Azevedo2023-09-041-7/+9
| | | | Signed-off-by: Lucas Azevedo <lhs_azevedo@hotmail.com>
* fix(mimetype): Remove unnecessary transaction when storing a mime typeLucas Azevedo2023-09-011-26/+22
| | | | | | | | | | | | Fixes #40064. This could be fixed by adding a rollback and starting a new transaction before the SELECT query, but in this case that would have the same effect as not using one. See https://dev.mysql.com/doc/refman/8.0/en/innodb-autocommit-commit-rollback.html and https://www.postgresql.org/docs/7.1/sql-begin.html#R1-SQL-BEGIN-1 Signed-off-by: Lucas Azevedo <lhs_azevedo@hotmail.com>
* Merge pull request #38261 from fsamapoor/replace_strpos_calls_in_lib_privateRobin Appelman2023-06-011-4/+4
|\ | | | | Refactors "strpos" calls in lib/private to improve code readability.
| * Update Detection.phpFaraz Samapoor2023-05-171-1/+1
| | | | | | | | | | | | | | The latter implies the former. https://github.com/nextcloud/server/pull/38261#discussion_r1196708412 Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com>
| * Refactors "strpos" calls in lib/private to improve code readability.Faraz Samapoor2023-05-151-4/+4
| | | | | | | | Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
* | fix(mimetype): Fix returning value when finding existing mimetype in ↵Thomas Citharel2023-05-041-16/+10
|/ | | | | | | | | | | MimeType Loader Also, only return the ID from the transaction as the mimetype string is already used from the function argument value Fixes https://github.com/nextcloud/server/pull/35744/files#r1184644610 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
* Put Mimeloader insertion and read in the same transactionThomas Citharel2023-04-171-18/+41
| | | | Signed-off-by: Thomas Citharel <tcit@tcit.fr>
* composer run cs:fixCôme Chilliet2023-01-202-3/+1
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* Migrate from ILogger to LoggerInterface in lib/privateCôme Chilliet2022-03-241-10/+3
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* Update php licensesJohn Molakvoæ (skjnldsv)2021-06-043-3/+0
| | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
* Update all license headers for Nextcloud 21Christoph Wurst2020-12-161-1/+2
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Don't leave cursors open when tests failJoas Schilling2020-11-091-2/+8
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Properly add both mimetypes to secure mimetype mappingJulius Härtl2020-09-071-1/+7
| | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
* Update the license headers for Nextcloud 20Christoph Wurst2020-08-241-0/+2
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Extra white space to follow other ifslui87kw2020-07-151-1/+1
| | | | Signed-off-by: lui87kw <lukas.ifflaender@uni-wuerzburg.de>
* Avoid substr() error when strpos returns falsebladewing2020-07-151-6/+9
| | | | | | | | "Exception: substr() expects parameter 3 to be int, bool given" can occur on Line 378 $mimePart = substr($icon, 0, strpos($icon, '-')); This happens, when '-' is not found and strpos returns false instead of an int. When this occurs, e.g., Activity hangs. Signed-off-by: lui87kw <lukas.ifflaender@uni-wuerzburg.de>
* Format control structures, classes, methods and functionChristoph Wurst2020-04-102-3/+0
| | | | | | | | | | | | | | | To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Update the license headers for Nextcloud 19Christoph Wurst2020-03-313-1/+2
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Merge pull request #20170 from nextcloud/techdebt/remove-unused-importsChristoph Wurst2020-03-271-1/+0
|\ | | | | Remove unused imports
| * Remove unused importsChristoph Wurst2020-03-251-1/+0
| | | | | | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* | Use the short array syntax, everywhereChristoph Wurst2020-03-262-2/+2
|/ | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Update license headers for 18Christoph Wurst2019-12-201-0/+3
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Fix detection of non extention typesRoeland Jago Douma2019-12-121-3/+6
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Try more methodsJoas Schilling2019-12-101-3/+12
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Some more fixes in detecting the mimetype from the contentJoas Schilling2019-12-101-15/+17
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Cleanup the codeJoas Schilling2019-12-101-43/+45
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Allow to check for the mimetype by content onlyJoas Schilling2019-12-101-7/+21
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Move custom definition logic into methodDaniel Kesselberg2019-12-091-21/+16
| | | | Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
* Ensure that we don't merge broken json.Daniel Kesselberg2019-12-091-6/+25
| | | | Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
* Update license headersChristoph Wurst2019-12-053-3/+6
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Some php-cs fixesRoeland Jago Douma2019-11-221-1/+1
| | | | | | | | | | | * Order the imports * No leading slash on imports * Empty line before namespace * One line per import * Empty after imports * Emmpty line at bottom of file Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Deprecate TemplateManagerJulius Härtl2019-10-161-0/+5
| | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
* Do not fail integrity check if mimetype list is changedXheni Myrtaj2019-05-291-0/+6
| | | | Signed-off-by: Xheni Myrtaj <myrtajxheni@gmail.com>
* Use the defined func()->count() instead of manual countingJoas Schilling2018-11-081-1/+1
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* use insertIfNotExists to store new mimetypes.Robin Appelman2018-08-091-14/+7
| | | | | | Also throw an error if we can't find the mimetype after insert Signed-off-by: Robin Appelman <robin@icewind.nl>
* Update license headersMorris Jobke2017-11-062-0/+6
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Improve mimetype detection for object storagesMorris Jobke2017-10-261-0/+4
| | | | | | Object storage instances always fall back to the content based mimetype detection, because the file name for object storage was always random due to the fact that it was temporarily storage in a generated temp file. This patch adds a check before that to make sure to use the original file name for this purpose and also remove possible other extensions like the versioning or part file extension. Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Dont swallow exception when inserting mimetypes if we're inside a transactionRobin Appelman2017-08-261-0/+4
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* Fix variable namesJoas Schilling2017-05-151-6/+6
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>