ochorocho / kap-nextcloud

KAP screen record plugin to upload files to Nextcloud
MIT License
3 stars 0 forks source link

Export with Password #5

Open wsoyka opened 4 years ago

wsoyka commented 4 years ago

When using the setting use "Set random password for share" setting the plugin fails to get the sharing url - clipboard is set to something like:

undefined

Valid until: 24-05-2020
Password: U5TTrhZjRJ

The file is being uploaded successfully, but I dont get a sharing url.

checking sentry/scrope_v2.json seems to tell me that the sharing POST to my nextcloud instace fails with a 401:

{
      "timestamp": 1589456311.133,
      "category": "http",
      "data": {
        "method": "PUT",
        "status_code": 201,
        "url": "//<mynexctloud.tld>/remote.php/webdav/kap2/Kapture%202020-05-14%20at%2013.38.27.mp4"
      },
      "type": "http"
    },
    {
      "timestamp": 1589456320.059,
      "category": "http",
      "data": {
        "method": "POST",
        "status_code": 401,
        "url": "//<mynextcloud.tld>/ocs/v1.php/apps/files_sharing/api/v1/shares"
      },
      "type": "http"
    }
  ],
  "_user": {},
  "_tags": {},
  "_extra": {},
  "_context": {}
}

I am using App Token Auth, in case this is relevant.

When I disable the random password the plugin works perfectly. Do you have any ideas on this?

ochorocho commented 4 years ago

Hey, thanks for your report. Don't know a solution on top of my head.

But will try to check the problem on the weekend.

wsoyka commented 4 years ago

Thank you!

wsoyka commented 4 years ago

@ochorocho can you reproduce the problem? got any ideas for a solution?

Running on Nextcloud 18.0.4

ochorocho commented 4 years ago

Seems like the file name needs to be url encoded. Did not have the time to test so far. Will test tomorrow.

https://github.com/ochorocho/kap-nextcloud/blob/master/index.js#L27

ochorocho commented 4 years ago

@wsoyka try version 1.4.1 . This is working for me now.

wsoyka commented 4 years ago

@ochorocho thanks for the quick response!

this new(?) notification got me on the right trail: Screenshot 2020-06-09 at 15 16 30

while the text is not correct (because public uploads are allowed and more importantly, random password was enabled.), i figured out that the minimal password length was set to 32 and kap-nextcloud attempts to use shorter passwords.

Solutions I see:

While i'm not familiar with nextclouds sharing API, but i couldn't find a way to get the required minimum password lenght.

about the wrong notification text: Im guessing here the errorhandling would have to be amended to either distinguish between admin not allowing uploads or password length errors, or you could just add both infos to the notification and let users figure it out.

also: using either auth method (login/app token) gets stuck. after two minutes i closed the window and stopped the current upload. at this time the credentials are saved correctly to the config file, and new exports can upload files. => i'm guessing this is a seperate issue? should I open one?

Hope this is helpful!

ochorocho commented 4 years ago

Thanks for your detailed report.

While i'm not familiar with nextclouds sharing API, but i couldn't find a way to get the required minimum password length.

The returned error message is "Password needs to be at least 32 characters long" so i could regex the number/length from the given string. Not a beautiful, but a possible solution.

Asked in Nextcloud IRC for help.

Im guessing here the errorhandling would have to be amended to either distinguish between admin not allowing uploads or password length errors, or you could just add both infos to the notification and let users figure it out.

Now using Nextcloud APIs returned error message:

context.notify(body.ocs.meta.message)

using either auth method (login/app token) gets stuck. after two minutes i closed the window and stopped the current upload. at this time the credentials are saved correctly to the config file, and new exports can upload files.

Please open a new issue :-)

ochorocho commented 4 years ago

using either auth method (login/app token) gets stuck. after two minutes i closed the window and stopped the current upload. at this time the credentials are saved correctly to the config file, and new exports can upload files.

Tried to fix this issue in latest version (v1.4.3)

@wsoyka let me know if it works for you now

wsoyka commented 4 years ago

Tried to fix this issue in latest version (v1.4.3)

See #6.