Closed vanBonzen closed 5 years ago
Thanks for the report. Could you describe the issues it's causing in a bit more detail? Please also post Nextshot's output with any errors you're getting, and which distro you're using.
I'd like to make the default filename an option in config at some point, so this issue should be fixed in case anyone adds spaces themselves.
If you set the rename
option to true
in your config and manually type in a filename with spaces when you take a screenshot, do you still see the same issues?
Could you describe the issues it's causing in a bit more detail? Please also post Nextshot's output with any errors you're getting, and which distro you're using.
If my NextShot is using your default picture naming convention, i am getting following output:
Screenshot mode set to selection
Output will be sent to Nextcloud
Loading config from /home/void/.config/nextshot/nextshot.conf...
Config loaded!
Uploading screenshot...
Upload failed. Expected 201 but server returned a 400 response
After changing the convention as mentioned above in your script or changing it via rename function the upload works flawless.
I am currently using arch with 5.1.4 kernel and nextCloud 15.0.5 as Docker-Image on my OpenShift Cluster.
I'd like to make the default filename an option in config at some point, so this issue should be fixed in case anyone adds spaces themselves.
That would be awesome. Thank you very much for your fast response, nice piece of software.
Kind regards, vanBonzen
Thanks for the extra info and kind words :)
Does changing it via rename also work if you set a name that has spaces, or do spaces still fail even with the rename function? I'm wondering if the issue could be with quoting, but really that shouldn't be the problem here.
Which Docker image are you using? I think my Nextcloud server is still on v13 currently which seems to work fine with spaces. If I can set up a test environment that matches yours it may be easier to find the root cause.
Does changing it via rename also work if you set a name that has spaces, or do spaces still fail even with the rename function? I'm wondering if the issue could be with quoting, but really that shouldn't be the problem here.
If i change the name via renaming function to e.g. a b.jpg
it displays the same error I mentioned on the second post.
Which Docker image are you using?
Using nextcloud:15.0.5-apache with mariadb:10.4.2 from official registry.
Kind regards, vanBonzen
Thanks, I'll try it out with that image later to see if I can replicate. So far it's working with v13 (benyanke/nextcloud image) and also the official v16 image.
I'll also see about adding a --debug
or --verbose
flag to run the curl commands without redirecting their output to /dev/null
. If I can't replicate with the image you're using, we'll need that to see the actual error(s) being returned from Nextcloud.
@vanBonzen I've just pushed 1.2.0 to AUR with support for verbose/debug mode.
Could you update your Nextshot and run it with -v
? It'll spit out the full response it gets from Nextcloud above the usual "Upload failed" error.
Sorry it took a few days, I wanted to get a couple other fixes/features finalised first and I've been busy with other bits too.
@dshoreman After reinstalling from AUR I get this error above in verbose mode. By now i'm not sure about what is causing this issue.
Kind regards, vanBonzen
After again changing the naming to :
take_screenshot() {
local filename filepath shoot
filename="$(date "+%Y-%m-%d-%H-%M-%S").png"
it again works as intended.
EDIT: By now I have upgraded my NextCloud to the most recent version from the official registry. But the same Error remains with the file-naming.
Kind regards, vanBonzen
Thanks for testing. When I deliberately broke the upload URL to test the debug output, the errors were from WebDAV but yours doesn't seem to even get that far.
Since the official image is known to work, it might be an issue with routing/proxying between your server and docker that's breaking the URL before it gets sent to Nextcloud.
That said, I'd still like to get this "fixed". I've tried setting filename to use %20
instead of space which works for the upload, but the share request gets a 404. I have a couple other ideas, so I'll try a few things out then post back when I have something.
Edit: Using +
ends up as part of the filename in Nextcloud, so that's out. Replacing the space on the fly is looking promising though. I'll push a new branch for testing shortly.
@vanBonzen Hopefully #58 (specifically 1971eaf) should solve this - could you confirm whether it fixes the issue?
If you'd rather patch manually instead of cloning the bad-request-fix
branch, it's enough to change $filename
to ${filename// /%20}
on line 531 - the rest is extra debugging output. Thanks!
@dshoreman
sorry it took a while to answer, I had so much work the last days. It seems like the bad-request-fix branch fixed the issue for me.
Thank you very much for your time and effort! I would appreciate an updated AUR build with that branch.
Keep up the good work!
Kind regards, vanBonzen
No worries, thanks for confirming the fix. It's still a mystery why spaces don't work in your setup, but it's good to know it's easily fixed.
There's still a few things I have to finish up in other projects first, but I'll merge the branch and make a new release shortly.
@vanBonzen v1.2.2 is now in AUR with the fix.
Thanks again for reporting and helping to test this edge case bug. If there's anything else you'd like to see in Nextshot please feel free to create a new issue. I mostly created it to solve my own needs, but I'm always open to new ideas
Hey,
if you could change the filename convention to:
by default, it would prevent issues caused by the backspace while uploading to NextCloud.
Kind regards,
vanBonzen