-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't load app for dav requests #135
Conversation
Signed-off-by: Daniel Kesselberg <[email protected]>
Signed-off-by: Daniel Kesselberg <[email protected]>
@kesselb so when installing this version of the app, it should automatically add the mimetype to the config files, correct? What should happen when there is already an entry for the mimetype in the config? |
|
||
if (file_exists($mappingFile)) { | ||
$existingMapping = json_decode(file_get_contents($mappingFile), true); | ||
if (json_last_error() === JSON_ERROR_NONE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (json_last_error() === JSON_ERROR_NONE) { | |
if (json_last_error() === JSON_ERROR_NONE && is_array($existingMapping)) { |
otherwise array_merge logs a warning and returns null.
Thanks @SimJoSt 👍
Yes. The mapping will be added to
If the app is disabled (either via the app manager or on upgrade if the app is not compatible).
The expected result is to see the entry for kdbx once. That should array_merge already do. |
Signed-off-by: Daniel Kesselberg <[email protected]>
7d0bb98
to
3a5ca0c
Compare
I just tested this in a development environment with NC18 in docker and can confirm that the registration and unregistration is working properly. |
I don't quite like the way this is done in general. Every app which can open a file with a given mimetype has its own implementation for the (un)registration of a MimeType. I would like it far better if the core server provided a maintained functionality with a recommended usage to (un)register and mimetypes by just providing the needed mapping. |
Unfortunately this is still not solved. Also see nextcloud/server#9192 |
@jhass To me this looks fine. I'd like to include this for the NC 19 update as well, what do you think? |
Your call, this is exactly the kind of thingies I'm a bit tired off to be honest :P |
After #124 it's not longer necessary to add a mapping kdbx => application/x-kdbx to
mimetypemapping.json
. Instead the keeweb app is loaded for every request and adds the mapping.Loading the app for every request is not ideal. Recently @sndrr pointed me to dicomviewer app and how they solved that problem. The app automatically appends the mapping for the mime types to
mimetypemapping.json
and the admins don't have to deal with json. This PR will add the same for keeweb app. Kudos to @ayselafsar for the idea 🚀.cc @maurerle @SimJoSt mind to help me testing? ;)