.kdbx file in nextcloud don't open in keeweb #34

Open
derjohannes19 opened this Issue Dec 18, 2016 · 83 comments

Comments

Projects
None yet
@derjohannes19

When I click on a .kdbx file the file will get downloaded, and it don't get open in keeweb.

Also: Webdav is not working, i get http 401 error.

@aalaesar

This comment has been minimized.

Show comment
Hide comment
@aalaesar

aalaesar Dec 19, 2016

+1
tested on nextcloud 11.0.0 & 10.0.2

+1
tested on nextcloud 11.0.0 & 10.0.2

@jackxb

This comment has been minimized.

Show comment
Hide comment
@jackxb

jackxb Dec 19, 2016

+1
tested on nextcloud 11.0.0

jackxb commented Dec 19, 2016

+1
tested on nextcloud 11.0.0

@xamindar

This comment has been minimized.

Show comment
Hide comment
@xamindar

xamindar Dec 20, 2016

Same issue here. Just installed it in nextcloud 11 and nothing has changed regarding clicking on kdbx files. Click on them, and they are downloaded. They do not open in keeweb.

Same issue here. Just installed it in nextcloud 11 and nothing has changed regarding clicking on kdbx files. Click on them, and they are downloaded. They do not open in keeweb.

@geiseri

This comment has been minimized.

Show comment
Hide comment
@geiseri

geiseri Dec 21, 2016

Same here on 11.

geiseri commented Dec 21, 2016

Same here on 11.

@scottharwell

This comment has been minimized.

Show comment
Hide comment
@scottharwell

scottharwell Dec 21, 2016

I don't intend to add another "me too", but I have some other details. I have found that if I disable the app on Nextcloud 11, and then restart it, then I am able to select a keepass db for about 30 mins. After that, the webdav connection seems to "break" and keeweb seems to move the open DB to a managed db outside of the Nextcloud integration. I then get the download behavior that others describe. Deleting the connection from keeweb, disabling keeweb, enabling keeweb, and reopening the ldbx file then allows me to use it again. Maybe this behaviour description will help.

I don't intend to add another "me too", but I have some other details. I have found that if I disable the app on Nextcloud 11, and then restart it, then I am able to select a keepass db for about 30 mins. After that, the webdav connection seems to "break" and keeweb seems to move the open DB to a managed db outside of the Nextcloud integration. I then get the download behavior that others describe. Deleting the connection from keeweb, disabling keeweb, enabling keeweb, and reopening the ldbx file then allows me to use it again. Maybe this behaviour description will help.

@Echse27

This comment has been minimized.

Show comment
Hide comment
@Echse27

Echse27 Dec 21, 2016

After install the KeeWeb App inside NC11.0.0, you can choose a .kdbx file only one time by klicking the file itself.
When you edit a entry or add one, there is no sync back to the main .kdbx database.
Error: HTTP status 401
So now i cant found a way to drop the file from the WebApp...

Echse27 commented Dec 21, 2016

After install the KeeWeb App inside NC11.0.0, you can choose a .kdbx file only one time by klicking the file itself.
When you edit a entry or add one, there is no sync back to the main .kdbx database.
Error: HTTP status 401
So now i cant found a way to drop the file from the WebApp...

@Yamakasi

This comment has been minimized.

Show comment
Hide comment
@Yamakasi

Yamakasi Dec 24, 2016

Opening in Keeweb worked for me but just stopped without updating anything, only my browser (Chromium) is updated.

Opening in Keeweb worked for me but just stopped without updating anything, only my browser (Chromium) is updated.

@Huster-at-github

This comment has been minimized.

Show comment
Hide comment
@Huster-at-github

Huster-at-github Dec 24, 2016

Same here. Does it need to be registered as a mimetype?

Same here. Does it need to be registered as a mimetype?

@Yamakasi

This comment has been minimized.

Show comment
Hide comment
@Yamakasi

Yamakasi Dec 24, 2016

I'm not sure, when I had a browsercache issue when upgraded to NC11 it just worked like that after I fixed that (cleared more hours of cache) and now it just stopped.

I thought I needed Webdav so was kinda surprised that clicking on it just worked!

I hope @jhass that he can give us some idea.

I'm not sure, when I had a browsercache issue when upgraded to NC11 it just worked like that after I fixed that (cleared more hours of cache) and now it just stopped.

I thought I needed Webdav so was kinda surprised that clicking on it just worked!

I hope @jhass that he can give us some idea.

@nschiwy

This comment has been minimized.

Show comment
Hide comment
@nschiwy

nschiwy Dec 25, 2016

I've now been able to "fix" this twice by disabling and then re-enabling the app. For the time being I'm probably just going to use a URL shortener to open the URL, which tells it the nextcloud location of the database. (ex. https://your-url.com/nextcloud/index.php/apps/keeweb/?open=%2Fpath%2Fto%2Fdatabase.kdbx) though I can't be sure whether this will allow it to save correctly...

nschiwy commented Dec 25, 2016

I've now been able to "fix" this twice by disabling and then re-enabling the app. For the time being I'm probably just going to use a URL shortener to open the URL, which tells it the nextcloud location of the database. (ex. https://your-url.com/nextcloud/index.php/apps/keeweb/?open=%2Fpath%2Fto%2Fdatabase.kdbx) though I can't be sure whether this will allow it to save correctly...

@Yamakasi

This comment has been minimized.

Show comment
Hide comment
@Yamakasi

Yamakasi Dec 25, 2016

Re-enabeling is a very good tip, this works indeed and happened also at my side when I had caching issues and re-enabled the app after emptying my cache. Maybe some mimetype magic happens in the browsercache when you enable it ?

Re-enabeling is a very good tip, this works indeed and happened also at my side when I had caching issues and re-enabled the app after emptying my cache. Maybe some mimetype magic happens in the browsercache when you enable it ?

@rocky4546

This comment has been minimized.

Show comment
Hide comment
@rocky4546

rocky4546 Dec 25, 2016

[updated] I have some info that may help. First, I found the command to update the database indexes that will cause files located in the data area to launch KeeWeb. This command is
sudo -u www-data php [nextcloud home]/occ -vvv files:scan --all

I still have issues, but this is very close. If the file in the data area is updated, either from KeeWeb or externally updated by KeePass, it will break versioning and sharing. Running the occ command will fix launching KeyWeb, but the bugs for versioning and sharing still exist. This is not an option for me since I would like multiple people to access the password file.

The solution I found is to put the file in an external storage area. Uploading the file and then running the occ command seems to make it work. Any updates and running the occ command will also make it work. I plan to run multiple cronjobs with this command. One every so often that does the entire system and others that run very often for places that KeePass files are kept. The command to run only on a specific folder is
sudo -u www-data php [nextcloud home]/occ -vvv --path=/[admin]/files/[external path] files:scan

At some point in the future, it would be nice to not have to have these workarounds in place, but I think I am good for now. Good Luck

rocky4546 commented Dec 25, 2016

[updated] I have some info that may help. First, I found the command to update the database indexes that will cause files located in the data area to launch KeeWeb. This command is
sudo -u www-data php [nextcloud home]/occ -vvv files:scan --all

I still have issues, but this is very close. If the file in the data area is updated, either from KeeWeb or externally updated by KeePass, it will break versioning and sharing. Running the occ command will fix launching KeyWeb, but the bugs for versioning and sharing still exist. This is not an option for me since I would like multiple people to access the password file.

The solution I found is to put the file in an external storage area. Uploading the file and then running the occ command seems to make it work. Any updates and running the occ command will also make it work. I plan to run multiple cronjobs with this command. One every so often that does the entire system and others that run very often for places that KeePass files are kept. The command to run only on a specific folder is
sudo -u www-data php [nextcloud home]/occ -vvv --path=/[admin]/files/[external path] files:scan

At some point in the future, it would be nice to not have to have these workarounds in place, but I think I am good for now. Good Luck

@juanjux

This comment has been minimized.

Show comment
Hide comment
@juanjux

juanjux Dec 31, 2016

As a tip, you don't need to disable and reenable the app to use the file from Keeweb: if you open the Keeweb app from the initial app menu the file will show in the list and opening it from there will work even if Keeweb doesn't open from the Files app.

juanjux commented Dec 31, 2016

As a tip, you don't need to disable and reenable the app to use the file from Keeweb: if you open the Keeweb app from the initial app menu the file will show in the list and opening it from there will work even if Keeweb doesn't open from the Files app.

@Yamakasi

This comment has been minimized.

Show comment
Hide comment
@Yamakasi

Yamakasi Dec 31, 2016

@dnauck

This comment has been minimized.

Show comment
Hide comment
@dnauck

dnauck Jan 7, 2017

For me the workaround with disable/enable the app or scan all files does not help.

I' ve the following message in my java script console:

Resource interpreted as Document but transferred with MIME type application/octet-stream

Looks like the mime type is not registered.

dnauck commented Jan 7, 2017

For me the workaround with disable/enable the app or scan all files does not help.

I' ve the following message in my java script console:

Resource interpreted as Document but transferred with MIME type application/octet-stream

Looks like the mime type is not registered.

@gadolithium

This comment has been minimized.

Show comment
Hide comment
@gadolithium

gadolithium Jan 8, 2017

+1 tested on NC 11.0.0.

+1 tested on NC 11.0.0.

@dennisheitmann

This comment has been minimized.

Show comment
Hide comment
@dennisheitmann

dennisheitmann Jan 14, 2017

+1 does not work (click on file in NC 11)

+1 does not work (click on file in NC 11)

@juanjux

This comment has been minimized.

Show comment
Hide comment
@juanjux

juanjux Jan 14, 2017

@Yamakasi it's true, a little later I lost the session and it dissapeared from the "recent files" list. But maybe I found another workaround? Tested with several different browsers, computers, networks and incognito mode so the session shouldn't exist. If you go directly to the keeweb + file URL like:

https://mydomain.com/apps/keeweb/?open=/mifile.kdbx

It seems to work.

juanjux commented Jan 14, 2017

@Yamakasi it's true, a little later I lost the session and it dissapeared from the "recent files" list. But maybe I found another workaround? Tested with several different browsers, computers, networks and incognito mode so the session shouldn't exist. If you go directly to the keeweb + file URL like:

https://mydomain.com/apps/keeweb/?open=/mifile.kdbx

It seems to work.

@grojas7

This comment has been minimized.

Show comment
Hide comment
@grojas7

grojas7 Jan 16, 2017

+1
Tested on Nextcloud 11.0.0

grojas7 commented Jan 16, 2017

+1
Tested on Nextcloud 11.0.0

@juanjux

This comment has been minimized.

Show comment
Hide comment
@juanjux

juanjux Jan 16, 2017

Yes, this is still happening on 11.0.1.

juanjux commented Jan 16, 2017

Yes, this is still happening on 11.0.1.

@SonireolxXx

This comment has been minimized.

Show comment
Hide comment
@SonireolxXx

SonireolxXx Jan 18, 2017

Same problem here on NC 11.0.1
I'm using WebDAV to sync with other devices, once the file is updated by other clients this problem occurs.

Same problem here on NC 11.0.1
I'm using WebDAV to sync with other devices, once the file is updated by other clients this problem occurs.

@mwalbeck

This comment has been minimized.

Show comment
Hide comment
@mwalbeck

mwalbeck Jan 18, 2017

I think I've nailed down the issue. When you edit and save a file, keeweb saves it in a new file with a unix timestamp after the name then proceeds to delete the old file and rename the new one to remove the timestamp. Nextcloud registers the file with the unix timestamp as the extension and caches that information, so the cached mimetype is wrong. It's saved as a hidden file.

Also the way the kdbx mimetype is registered, if you upload a keepass file after you've enabled the app it will be cached with a generic mimetype instead of the kdbx mimetype. I don't really know the details on this one.

You shouldn't use the fix below. It has had serious performance issues for some people. Rather look at the fix here #34 (comment)


I've created a small fix for the above. It's not the best solution but It works. It simply changes the mimetype of any .kdbx file in the filecache everytime you reload a page in nextcloud, so it might effect performance depending on your setup.

If you add

$mimetypeId = $mimeTypeLoader->getId('x-application/kdbx');
$mimeTypeLoader->updateFilecache('%.kdbx', $mimetypeId);

Below

// Register custom mimetype we can hook in the frontend
$mimeTypeDetector->getAllMappings();
$mimeTypeDetector->registerType('kdbx', 'x-application/kdbx', 'x-application/kdbx');

In your appinfo/app.php file you should be good. (It's at the bottom)

I can make a pull request if there is interest for this, but none the less I'll try to find a more elegant solution and make a pull request with that instead.

mwalbeck commented Jan 18, 2017

I think I've nailed down the issue. When you edit and save a file, keeweb saves it in a new file with a unix timestamp after the name then proceeds to delete the old file and rename the new one to remove the timestamp. Nextcloud registers the file with the unix timestamp as the extension and caches that information, so the cached mimetype is wrong. It's saved as a hidden file.

Also the way the kdbx mimetype is registered, if you upload a keepass file after you've enabled the app it will be cached with a generic mimetype instead of the kdbx mimetype. I don't really know the details on this one.

You shouldn't use the fix below. It has had serious performance issues for some people. Rather look at the fix here #34 (comment)


I've created a small fix for the above. It's not the best solution but It works. It simply changes the mimetype of any .kdbx file in the filecache everytime you reload a page in nextcloud, so it might effect performance depending on your setup.

If you add

$mimetypeId = $mimeTypeLoader->getId('x-application/kdbx');
$mimeTypeLoader->updateFilecache('%.kdbx', $mimetypeId);

Below

// Register custom mimetype we can hook in the frontend
$mimeTypeDetector->getAllMappings();
$mimeTypeDetector->registerType('kdbx', 'x-application/kdbx', 'x-application/kdbx');

In your appinfo/app.php file you should be good. (It's at the bottom)

I can make a pull request if there is interest for this, but none the less I'll try to find a more elegant solution and make a pull request with that instead.

@SonireolxXx

This comment has been minimized.

Show comment
Hide comment
@SonireolxXx

SonireolxXx Jan 18, 2017

@mwalbeck Thank you for the solution, I just tried it on NC 11.0.1 and it works, didn't notice any significant impact on performance.

I think this is the best approach for the issue so far.

@mwalbeck Thank you for the solution, I just tried it on NC 11.0.1 and it works, didn't notice any significant impact on performance.

I think this is the best approach for the issue so far.

@Yamakasi

This comment has been minimized.

Show comment
Hide comment
@Yamakasi

Yamakasi Jan 19, 2017

@mwalbeck

This comment has been minimized.

Show comment
Hide comment
@mwalbeck

mwalbeck Jan 24, 2017

@jhass I've send a pull request to upstream nextcloud to fix the issue with mimetype detection on hidden files I talked about here #38. This is only half the problem though. From what I've found the mimetype detection doesn't utilize the oc_mimetypes database tables to look up mimetypes. So the only proper way to currently register the mimetype is in the mimetypemapping file in nextcloud server. So if the mimetype is registered with upstream nextcloud this issue would be resolved with the release of nextcloud 12.

Thoughts?

@jhass I've send a pull request to upstream nextcloud to fix the issue with mimetype detection on hidden files I talked about here #38. This is only half the problem though. From what I've found the mimetype detection doesn't utilize the oc_mimetypes database tables to look up mimetypes. So the only proper way to currently register the mimetype is in the mimetypemapping file in nextcloud server. So if the mimetype is registered with upstream nextcloud this issue would be resolved with the release of nextcloud 12.

Thoughts?

@jhass

This comment has been minimized.

Show comment
Hide comment
@jhass

jhass Jan 24, 2017

Owner

Well, registering the mimetype upstream would certainly work, but that feels like a band-aid to a missing feature in the app API, so I'd prefer to either have the detection use the database or have an API to ship a mimetype used for detection with an app, for example by shipping another json file that's aggregated with the default one.

Owner

jhass commented Jan 24, 2017

Well, registering the mimetype upstream would certainly work, but that feels like a band-aid to a missing feature in the app API, so I'd prefer to either have the detection use the database or have an API to ship a mimetype used for detection with an app, for example by shipping another json file that's aggregated with the default one.

@guddl

This comment has been minimized.

Show comment
Hide comment
@guddl

guddl Jan 25, 2017

I had this problem when I resticted the app to be available for a special group only.
After removing the group from "Enable only for specific groups" everything works fine again.

guddl commented Jan 25, 2017

I had this problem when I resticted the app to be available for a special group only.
After removing the group from "Enable only for specific groups" everything works fine again.

@dedero1985

This comment has been minimized.

Show comment
Hide comment
@dedero1985

dedero1985 Feb 2, 2017

Hi guys,

I tried the solution from mwalbeck and works great (thanks a lot!). I see no performance impacts under Nextcloud 11.0.1 using Keeweb v1.3.3 (52701af, 2016-12-17)

Cheers,
Bruno.

Hi guys,

I tried the solution from mwalbeck and works great (thanks a lot!). I see no performance impacts under Nextcloud 11.0.1 using Keeweb v1.3.3 (52701af, 2016-12-17)

Cheers,
Bruno.

@ds4a

This comment has been minimized.

Show comment
Hide comment
@ds4a

ds4a Feb 5, 2017

The temporary fix offered by @nschiwy of

I've now been able to "fix" this twice by disabling and then re-enabling the app.

works for me also.

ds4a commented Feb 5, 2017

The temporary fix offered by @nschiwy of

I've now been able to "fix" this twice by disabling and then re-enabling the app.

works for me also.

@Sanookmakmak

This comment has been minimized.

Show comment
Hide comment
@Sanookmakmak

Sanookmakmak Feb 9, 2017

Same here. Nextcloud 11.0.1 and Keeweb 0.3.0

Disabling and re-enabling the Keeweb app helps, but after a while it is no more possible to open the kdbx file. I just can be downloaded.

So the admin needs to disable and re-enable the app again (and again and again...)

:-(

Same here. Nextcloud 11.0.1 and Keeweb 0.3.0

Disabling and re-enabling the Keeweb app helps, but after a while it is no more possible to open the kdbx file. I just can be downloaded.

So the admin needs to disable and re-enable the app again (and again and again...)

:-(

@mwalbeck

This comment has been minimized.

Show comment
Hide comment
@mwalbeck

mwalbeck Feb 9, 2017

With the release of Nextcloud 12, you can fix this by adding a mimetypemapping.json file to your nextcloud/config folder. In the file you add the mimetype "kdbx": ["x-application/kdbx"]

For easy copy paste:

{
    "kdbx": ["x-application/kdbx"]
}

There is a little more info in the nextcloud admin docs here, https://docs.nextcloud.com/server/11/admin_manual/configuration_mimetypes/index.html

This will survive both app and system updates and should be the best solution until it can be done through the app itself.

mwalbeck commented Feb 9, 2017

With the release of Nextcloud 12, you can fix this by adding a mimetypemapping.json file to your nextcloud/config folder. In the file you add the mimetype "kdbx": ["x-application/kdbx"]

For easy copy paste:

{
    "kdbx": ["x-application/kdbx"]
}

There is a little more info in the nextcloud admin docs here, https://docs.nextcloud.com/server/11/admin_manual/configuration_mimetypes/index.html

This will survive both app and system updates and should be the best solution until it can be done through the app itself.

@ds4a

This comment has been minimized.

Show comment
Hide comment
@ds4a

ds4a Feb 9, 2017

@mwalbeck I have read the documentation you referred to at https://docs.nextcloud.com/server/11/admin_manual/configuration_mimetypes/index.html.
I'm a little confused as this doesn't seem to present a solution to this issue. The documentation refers to the mimetypealiases and mimetypemapping json files that allow NC to display the correct icon for a specified mimetype. The icon files are placed in the relevant theme directory. Am I missing something?
I directly edited the mimetypealiases.dist.json and mimetypemapping.dist.json files located in resources/config in my NC installation and ran the maintenance:mimetype:update-js command, and the reported issue still persists.

ds4a commented Feb 9, 2017

@mwalbeck I have read the documentation you referred to at https://docs.nextcloud.com/server/11/admin_manual/configuration_mimetypes/index.html.
I'm a little confused as this doesn't seem to present a solution to this issue. The documentation refers to the mimetypealiases and mimetypemapping json files that allow NC to display the correct icon for a specified mimetype. The icon files are placed in the relevant theme directory. Am I missing something?
I directly edited the mimetypealiases.dist.json and mimetypemapping.dist.json files located in resources/config in my NC installation and ran the maintenance:mimetype:update-js command, and the reported issue still persists.

@mwalbeck

This comment has been minimized.

Show comment
Hide comment
@mwalbeck

mwalbeck Feb 9, 2017

@ds4a I should probably have been a bit more specific, but if you only focus on the mimetypemapping aspect, which is a way to register a mimetype in nextcloud. Since this issue is a mimetype issue we can use the mimetypemapping file to register a mimetype in nextcloud. This is needed as there currently is no proper way for an app to register a new mimetype.

So we don't need to edit the mimetypealiases file or run the maintenance:mimetype:update-js command, as they are purely for matching icons and mimetypes.

Also, as I noted above, this will only work with Nextcloud 12 and onwards, because of a small change to the mimetype detection in Nextcloud.

mwalbeck commented Feb 9, 2017

@ds4a I should probably have been a bit more specific, but if you only focus on the mimetypemapping aspect, which is a way to register a mimetype in nextcloud. Since this issue is a mimetype issue we can use the mimetypemapping file to register a mimetype in nextcloud. This is needed as there currently is no proper way for an app to register a new mimetype.

So we don't need to edit the mimetypealiases file or run the maintenance:mimetype:update-js command, as they are purely for matching icons and mimetypes.

Also, as I noted above, this will only work with Nextcloud 12 and onwards, because of a small change to the mimetype detection in Nextcloud.

@ds4a

This comment has been minimized.

Show comment
Hide comment
@ds4a

ds4a Feb 9, 2017

@mwalbeck Thanks for the explanation and clarification.

ds4a commented Feb 9, 2017

@mwalbeck Thanks for the explanation and clarification.

@Darkitty

This comment has been minimized.

Show comment
Hide comment
@Darkitty

Darkitty Feb 15, 2017

"I've now been able to "fix" this twice by disabling and then re-enabling the app."

Fix the issue with Nextcloud 11.0.1 and version 0.3.0 :D

"I've now been able to "fix" this twice by disabling and then re-enabling the app."

Fix the issue with Nextcloud 11.0.1 and version 0.3.0 :D

@proehlen

This comment has been minimized.

Show comment
Hide comment
@proehlen

proehlen Feb 23, 2017

@mwalbeck 's code fix didn't fix the issue for me unfortunately. Upgrading to NextCloud 12 also isn't an option. I can't really disable/enable the app repeatedly either since the files change a lot. Anyone got any other ideas on this?

proehlen commented Feb 23, 2017

@mwalbeck 's code fix didn't fix the issue for me unfortunately. Upgrading to NextCloud 12 also isn't an option. I can't really disable/enable the app repeatedly either since the files change a lot. Anyone got any other ideas on this?

@yp6128

This comment has been minimized.

Show comment
Hide comment
@yp6128

yp6128 Mar 19, 2017

The enable/disable "fix" worked for me, but How to also open the *.key file ? 💃 :)

yp6128 commented Mar 19, 2017

The enable/disable "fix" worked for me, but How to also open the *.key file ? 💃 :)

@patschi

This comment has been minimized.

Show comment
Hide comment
@patschi

patschi May 24, 2017

Had the same reported issue as described here, with latest Nextcloud 12.0.0.29 (fresh install). Without any manually editing the mimetypemapping.json, just the mimetype:update-db command fixed it. I'm not that fimilar with the possibilities of the NC-plugin-development, but wouldn't it be possible to just trigger that command automatically when enabling this plugin?

patschi commented May 24, 2017

Had the same reported issue as described here, with latest Nextcloud 12.0.0.29 (fresh install). Without any manually editing the mimetypemapping.json, just the mimetype:update-db command fixed it. I'm not that fimilar with the possibilities of the NC-plugin-development, but wouldn't it be possible to just trigger that command automatically when enabling this plugin?

@AgenturVS

This comment has been minimized.

Show comment
Hide comment
@AgenturVS

AgenturVS May 26, 2017

Thanks, juanjux. I'm using your URL and it is working perfect for me.

Thanks, juanjux. I'm using your URL and it is working perfect for me.

@stratacast

This comment has been minimized.

Show comment
Hide comment
@stratacast

stratacast May 30, 2017

I did what @JSoko suggested and ran the command that @mwalbeck said to do and that fixed my problem with opening my .kdbx file on NC 12.0.0 with keeweb version 0.4. Thank you!

I did what @JSoko suggested and ran the command that @mwalbeck said to do and that fixed my problem with opening my .kdbx file on NC 12.0.0 with keeweb version 0.4. Thank you!

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jun 1, 2017

Was having the same issue myself in 12.0.0, but using the correct command from both @JSoko and @mwalbeck has fixed it for now. Just to clarify, the command is:

sudo -u www-data php /var/www/**NEXTCLOUD FOLDER**/occ maintenance:mimetype:update-db --repair-filecache

ghost commented Jun 1, 2017

Was having the same issue myself in 12.0.0, but using the correct command from both @JSoko and @mwalbeck has fixed it for now. Just to clarify, the command is:

sudo -u www-data php /var/www/**NEXTCLOUD FOLDER**/occ maintenance:mimetype:update-db --repair-filecache

@fthiery

This comment has been minimized.

Show comment
Hide comment
@fthiery

fthiery Jun 7, 2017

The workaround works (NC12), but needs to be repeated regulary; any idea why / how to fix this permanently ? Should i run this in a cron every minute ? Sounds like a bad solution to me... I believe that currently it should be run manually every time a new kbdx file is added.

I also added a cron to automate this:

root@nextcloud:/etc/cron.d# cat /etc/cron.d/fixmimetypes 
*/5 * * * * root sudo -u www-data php /var/www/html/nextcloud/occ maintenance:mimetype:update-db --repair-filecache

fthiery commented Jun 7, 2017

The workaround works (NC12), but needs to be repeated regulary; any idea why / how to fix this permanently ? Should i run this in a cron every minute ? Sounds like a bad solution to me... I believe that currently it should be run manually every time a new kbdx file is added.

I also added a cron to automate this:

root@nextcloud:/etc/cron.d# cat /etc/cron.d/fixmimetypes 
*/5 * * * * root sudo -u www-data php /var/www/html/nextcloud/occ maintenance:mimetype:update-db --repair-filecache

@stratacast

This comment has been minimized.

Show comment
Hide comment
@stratacast

stratacast Jul 7, 2017

@fthiery did you solve your problem? The solution of putting the .json file in your nextcloud/config folder is a permanently lasting solution

@fthiery did you solve your problem? The solution of putting the .json file in your nextcloud/config folder is a permanently lasting solution

@fthiery

This comment has been minimized.

Show comment
Hide comment
@fthiery

fthiery Jul 7, 2017

Yes it seems to work without the cron, sorry for not reporting.

fthiery commented Jul 7, 2017

Yes it seems to work without the cron, sorry for not reporting.

@zeigerpuppy

This comment has been minimized.

Show comment
Hide comment
@zeigerpuppy

zeigerpuppy Jul 8, 2017

Thanks @JSoko and @mwalbeck! I can confirm the following works well with NC12 (no need to enable/disable app or run any crons):

nano /var/www/nextcloud/config/mimetypemapping.json

add kdbx mimetype

{
    "kdbx": ["x-application/kdbx"]
}

update database of mimetypes

sudo -u www-data php /var/www/nextcloud/occ maintenance:mimetype:update-db --repair-filecache

Thanks @JSoko and @mwalbeck! I can confirm the following works well with NC12 (no need to enable/disable app or run any crons):

nano /var/www/nextcloud/config/mimetypemapping.json

add kdbx mimetype

{
    "kdbx": ["x-application/kdbx"]
}

update database of mimetypes

sudo -u www-data php /var/www/nextcloud/occ maintenance:mimetype:update-db --repair-filecache
@e-alfred

This comment has been minimized.

Show comment
Hide comment
@e-alfred

e-alfred Aug 20, 2017

Maybe the useful information from @zeigerpuppy can be put into the main readme file of this repository? It would help people a lot to get Keeweb open the files in Nextcloud.

Maybe the useful information from @zeigerpuppy can be put into the main readme file of this repository? It would help people a lot to get Keeweb open the files in Nextcloud.

@ds4a

This comment has been minimized.

Show comment
Hide comment
@ds4a

ds4a Aug 24, 2017

I just wanted to feedback that the upgrade to Keeweb 0.4.0 under NC 11.0.2 has resolved this issue for me. Although just to note that once upgraded the app needs to disabled and then reenabled, just the once! Then all is good. I can now select a keeweb file from NC and Keeweb opens in NC as expected.

I Like the other improvements delivered in Keeweb 0.4.0.

Well done to the NC maintainers on these fixes and improvements. Much appreciated, this is one of the most useful apps on NC, especially when you have lots of details to remember.

ds4a commented Aug 24, 2017

I just wanted to feedback that the upgrade to Keeweb 0.4.0 under NC 11.0.2 has resolved this issue for me. Although just to note that once upgraded the app needs to disabled and then reenabled, just the once! Then all is good. I can now select a keeweb file from NC and Keeweb opens in NC as expected.

I Like the other improvements delivered in Keeweb 0.4.0.

Well done to the NC maintainers on these fixes and improvements. Much appreciated, this is one of the most useful apps on NC, especially when you have lots of details to remember.

@theScrabi

This comment has been minimized.

Show comment
Hide comment
@theScrabi

theScrabi Sep 20, 2017

I'm using Nextcloud 12.0.3 and Keeweb 0.4.0, however this error still occurs for me, and it seems this solution does not work for me either?

I'm using Nextcloud 12.0.3 and Keeweb 0.4.0, however this error still occurs for me, and it seems this solution does not work for me either?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Oct 5, 2017

@theScrabi After updating to 12.0.3 myself, I found it wasn't working. Ran the following command (as above), and then after opening the database file from the file structure (as opposed to just launching Keeweb and expecting it to find it), it launches the Keeweb app.

sudo -u www-data php /var/www/**NEXTCLOUD FOLDER**/occ maintenance:mimetype:update-db --repair-filecache

The app then recognises where the database is after this, though trying to open it from the app with the db password, I get an error:

Error There was an error opening file [object Event]

So it works fine when opening it from the file structure, but not when opening it from the app itself.

ghost commented Oct 5, 2017

@theScrabi After updating to 12.0.3 myself, I found it wasn't working. Ran the following command (as above), and then after opening the database file from the file structure (as opposed to just launching Keeweb and expecting it to find it), it launches the Keeweb app.

sudo -u www-data php /var/www/**NEXTCLOUD FOLDER**/occ maintenance:mimetype:update-db --repair-filecache

The app then recognises where the database is after this, though trying to open it from the app with the db password, I get an error:

Error There was an error opening file [object Event]

So it works fine when opening it from the file structure, but not when opening it from the app itself.

@theScrabi

This comment has been minimized.

Show comment
Hide comment
@theScrabi

theScrabi Oct 10, 2017

Yes I can confirm. That worked :)

Yes I can confirm. That worked :)

@kevquirk

This comment has been minimized.

Show comment
Hide comment
@kevquirk

kevquirk Oct 12, 2017

I've not tested this workaround yet, but would updating the mimetype be required every time there is an NC update? Frustrating if that's the case. :(

I've not tested this workaround yet, but would updating the mimetype be required every time there is an NC update? Frustrating if that's the case. :(

@mammuth

This comment has been minimized.

Show comment
Hide comment
@mammuth

mammuth Oct 13, 2017

@kevquirk The webupdater does not override settings in the config. After the last updates I didn't need to update the mimetypes.

mammuth commented Oct 13, 2017

@kevquirk The webupdater does not override settings in the config. After the last updates I didn't need to update the mimetypes.

@kepuvv

This comment has been minimized.

Show comment
Hide comment
@kepuvv

kepuvv Oct 18, 2017

Thank, zeigerpuppy! Its work for me

kepuvv commented Oct 18, 2017

Thank, zeigerpuppy! Its work for me

@DMW007

This comment has been minimized.

Show comment
Hide comment
@DMW007

DMW007 Oct 31, 2017

I can confirm that the mime-mapping from @zeigerpuppy is working fine on Nextcloud 12. Seems like that the command read the mimetypemappings.json file and copy all those mapping in the database. So afaik it should be possible for the nextcloud-keeweb extension to register it's mapping autmatically after installation?

If not, I agree that we should at least refer to this issue in the documentation/installation guide. Otherwise, a lot of people are wasting time to find out why this is not working. I also did cause it's confusing.

DMW007 commented Oct 31, 2017

I can confirm that the mime-mapping from @zeigerpuppy is working fine on Nextcloud 12. Seems like that the command read the mimetypemappings.json file and copy all those mapping in the database. So afaik it should be possible for the nextcloud-keeweb extension to register it's mapping autmatically after installation?

If not, I agree that we should at least refer to this issue in the documentation/installation guide. Otherwise, a lot of people are wasting time to find out why this is not working. I also did cause it's confusing.

@ppmt

This comment has been minimized.

Show comment
Hide comment
@ppmt

ppmt Nov 18, 2017

My instance of NextCloud is on a hosted site so I don't have access to the command line. Is there another way to update the mime and database?

ppmt commented Nov 18, 2017

My instance of NextCloud is on a hosted site so I don't have access to the command line. Is there another way to update the mime and database?

@ggeorgg

This comment has been minimized.

Show comment
Hide comment
@ggeorgg

ggeorgg Nov 20, 2017

Upload the following cmd.phpx file to your nextcloud root.
cmd.zip
I also had to comment out line 39 in console.php (I am on nextcloud 12.0.3 with php 7.1 cgi, no php 5.6.0)
Open your browser and navigate to the cmd.phpx you have recently uploaded (e.g. https://nextcloud.domain.com/cmd.phpx)
That should do it.
At least undo your changes. Delete the cmd.phpx again and comment in the line in console.php, otherwise your nextcloud instance will complain the next time you want to update)

ggeorgg commented Nov 20, 2017

Upload the following cmd.phpx file to your nextcloud root.
cmd.zip
I also had to comment out line 39 in console.php (I am on nextcloud 12.0.3 with php 7.1 cgi, no php 5.6.0)
Open your browser and navigate to the cmd.phpx you have recently uploaded (e.g. https://nextcloud.domain.com/cmd.phpx)
That should do it.
At least undo your changes. Delete the cmd.phpx again and comment in the line in console.php, otherwise your nextcloud instance will complain the next time you want to update)

@ppmt

This comment has been minimized.

Show comment
Hide comment
@ppmt

ppmt Nov 20, 2017

@ggeorg : thanks a lot for the script. I can now open my keepass file from Nextcloud!

I had to activate a module called posix to make the script work and rename it to php from phpx

ppmt commented Nov 20, 2017

@ggeorg : thanks a lot for the script. I can now open my keepass file from Nextcloud!

I had to activate a module called posix to make the script work and rename it to php from phpx

@ludenticus

This comment has been minimized.

Show comment
Hide comment
@ludenticus

ludenticus Nov 24, 2017

Enabling/disabling the app has no effect on Nextcloud 12.0.3

Enabling/disabling the app has no effect on Nextcloud 12.0.3

@sunjam

This comment has been minimized.

Show comment
Hide comment
@sunjam

sunjam Dec 6, 2017

I've read through this thread and tried to setup Keeweb Webdav access on Nextcloud 12.0.4, but error I get is a little different.
error-header

sunjam commented Dec 6, 2017

I've read through this thread and tried to setup Keeweb Webdav access on Nextcloud 12.0.4, but error I get is a little different.
error-header

@sbrl

This comment has been minimized.

Show comment
Hide comment
@sbrl

sbrl Dec 6, 2017

@sunjam I'd suggest opening a separate issue about that.

sbrl commented Dec 6, 2017

@sunjam I'd suggest opening a separate issue about that.

@sesipod

This comment has been minimized.

Show comment
Hide comment
@sesipod

sesipod Dec 29, 2017

I got it working on Nextcloud 12.0.4 - Debian 9 x64

I put my .kdbx on an " SMB / CIFS " share.
Added the mimetypemapping.json file & restarted apache2.
https://github.com/jhass/nextcloud-keeweb/issues/34#issuecomment-278634544

I now can open the .kdbx form the SMB storage location.
Working for me on the following browsers....
Chrome Version 64.0.3282.39 (Official Build) beta (32-bit)
Firefox 57.0.3 (64-bit)

sesipod commented Dec 29, 2017

I got it working on Nextcloud 12.0.4 - Debian 9 x64

I put my .kdbx on an " SMB / CIFS " share.
Added the mimetypemapping.json file & restarted apache2.
https://github.com/jhass/nextcloud-keeweb/issues/34#issuecomment-278634544

I now can open the .kdbx form the SMB storage location.
Working for me on the following browsers....
Chrome Version 64.0.3282.39 (Official Build) beta (32-bit)
Firefox 57.0.3 (64-bit)

@jhass jhass referenced this issue Jan 4, 2018

Open

Nextcloud 13 #67

@schnappijedi

This comment has been minimized.

Show comment
Hide comment
@schnappijedi

schnappijedi Feb 7, 2018

Wanted to add (clarify) a workaround. Granted have never been able to edit a .kdbx file in Nextcloud but this will work for opening and otherwise using a database. Use a bookmark pointing to one's .kdbx database such as: https://server/index.php/apps/keeweb/?open=/AnyFolder/Keepass-database.kdbx

Nextcloud has a bookmarking app that one could put this URL into or could keep in it a simple text document. Not ideal but works.

schnappijedi commented Feb 7, 2018

Wanted to add (clarify) a workaround. Granted have never been able to edit a .kdbx file in Nextcloud but this will work for opening and otherwise using a database. Use a bookmark pointing to one's .kdbx database such as: https://server/index.php/apps/keeweb/?open=/AnyFolder/Keepass-database.kdbx

Nextcloud has a bookmarking app that one could put this URL into or could keep in it a simple text document. Not ideal but works.

@zerpex

This comment has been minimized.

Show comment
Hide comment
@zerpex

zerpex Feb 14, 2018

Don't understand this issue, I got it working since Nextcloud 11 & 12 & 13.
many kdbx files on nextcloud file manager : a click on one of them open it directly on keypass... The expected behaviour, right ?

Using Nextcloud on docker with hoellen/nextcloud image : https://github.com/hoellen/dockerfiles/tree/master/nextcloud
z.

zerpex commented Feb 14, 2018

Don't understand this issue, I got it working since Nextcloud 11 & 12 & 13.
many kdbx files on nextcloud file manager : a click on one of them open it directly on keypass... The expected behaviour, right ?

Using Nextcloud on docker with hoellen/nextcloud image : https://github.com/hoellen/dockerfiles/tree/master/nextcloud
z.

@DovendyrE

This comment has been minimized.

Show comment
Hide comment
@DovendyrE

DovendyrE Apr 9, 2018

Hi
I'm currently using keeweb in nextcloud 13.0.1
Just edited the /var/www/nextcloud/apps/keeweb/appinfo/info.xml to make it support nextcloud 13 then ran the command below to update mimetypes, and wokrs like charm here.
sudo -u www-data php /var/www/nextcloud/occ maintenance:mimetype:update-db --repair-filecache

PS. this command worked for me when I was still using nextcloud 12.

DovendyrE commented Apr 9, 2018

Hi
I'm currently using keeweb in nextcloud 13.0.1
Just edited the /var/www/nextcloud/apps/keeweb/appinfo/info.xml to make it support nextcloud 13 then ran the command below to update mimetypes, and wokrs like charm here.
sudo -u www-data php /var/www/nextcloud/occ maintenance:mimetype:update-db --repair-filecache

PS. this command worked for me when I was still using nextcloud 12.

@danger89

This comment has been minimized.

Show comment
Hide comment
@danger89

danger89 Apr 26, 2018

So is it fixed or.. does it still require manual actions from the admin?

So is it fixed or.. does it still require manual actions from the admin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment