Chaosmeister / EAR

Kanboard - Enable attachment renaming
5 stars 3 forks source link

Seems only attached image file rename are enabled? Anyway to rename attachment file? #1

Closed neotaburiss closed 2 years ago

neotaburiss commented 2 years ago

Do checked source code

Seems only attached image file rename are enabled? Anyway to rename attachment file?

Jieiku commented 2 years ago

This works for me: 2021-12-12_17-37

What are you trying to do?

On the kanboard backend, it does not keep the original filename anyway:

2021-12-12_17-40

So just renaming the displayed filename on the task is all that is needed right?

neotaburiss commented 2 years ago

Yes, "rename" image name and documents name is the function we needed.

Dropdown menu of "Rename" do appeared on the image I updloaded, but I click it, no further menu pop up.

Also Dropdown menu of "Rename" do not appear on the documents I uploaded.

I try to open the link(KANBOARD_URL/?controller=AttachmentHandler&action=rename&task_id=86&file_id=435&plugin=EAR) directly in browser, but it reminds "No access"

neotaburiss commented 2 years ago

Sorry to forgot to attach kanboard enviorment:

Application version: v1.2.20 PHP version: 7.4.19 PHP SAPI: fpm-fcgi HTTP client cURL System: Linux 4.19.94-Unraid Database driver: mysql Database version: 10.4.15-MariaDB-1:10.4.15+maria~bionic-log Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36

Jieiku commented 2 years ago

hmmm ok, so you see rename entry in the menu for attached picture but not for attached document.

and on attached picture you click the rename but nothing opens for you to be able to type the new name.

hopefully when @Chaosmeister sees this they can help. Everything is working on mine with chrome or firefox:

Ubuntu 20.04.3

 Application version: master.unknown_revision
 PHP version: 7.4.3
 PHP SAPI: fpm-fcgi
 HTTP Client: socket
 OS version: Linux 5.4.143-1-pve
 Database driver: postgres
 Database version: 12.9 (Ubuntu 12.9-0ubuntu0.20.04.1)
 Browser: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0

If using nginx/apache, if there are errors they may be in the logs. If you can find any errors there it may help to further debug this.

for nginx: sudo tail -f -n 100 /var/log/nginx/error.log

for apache sudo tail -f -n 100 /var/log/apache2/error.log

make sure to try clicking rename right before checking the logs so that any errors are easy to find.

Chaosmeister commented 2 years ago

hey hey

this requires an addition in kanboard base.
the dropdown for documents has no hook point yet.

I'll request the change and adjust the plugin

Chaosmeister commented 2 years ago

here's the required change

Chaosmeister commented 2 years ago

but I click it, no further menu pop up.

I can't reproduce this behaviour.

Chaosmeister commented 2 years ago

also I just added a release for version 1.1.0 with document renaming enabled as well

https://github.com/Chaosmeister/EAR/releases/tag/1.1.0

it still requires this change

Jieiku commented 2 years ago

sweet! will be grabbing this shortly, thanks!

neotaburiss commented 2 years ago

Many thanks for your help, modify the files.php rename function appear on attachement menu

But still when I click rename, further menu won't pop-up.

I opened the rename function link directly and kanboard reminds me "Access FORBIDDEN"

Could you help check if I can find some log for this error? kanboard debug logs did not show this error in its log

Chaosmeister commented 2 years ago

I opened the rename function link directly and kanboard reminds me "Access FORBIDDEN"

yeah this may be caused by multiple sources, like wrong task_id, wrong file_id or you really don't have access to the file you want to rename

Jieiku commented 2 years ago

neotaburiss were you able to check the web server logs?

is this Access Forbidden a result of not having access to the files, or is it a result of a file permissions error on your web server.

can you take a picture of the error?

If its really that you just dont have kanboard permissions to the file, you could try this, but im not sure if it would help: https://github.com/hernandezfo/AttachDocumentsforViewers

Jieiku commented 2 years ago

I just tested renaming a file that Another user added to the task. Even that works for me. But I do have project permissions on all projects.

Are the files your trying to rename, files that you originally added to the task? or that somebody else added to the task?

can you try renaming a file that you are the one that originally added the file. if it still dont work then i suspect its a permissions issue with the web server.

neotaburiss commented 2 years ago

Yes, I tested in admin account and normal user account both on image/attachment I just uploaded

Also just removed all plugins and still get same "Access forbidden" error.

Think it maybe related to mariadb? But where can I find the log?

Sorry for noob question, I'm a PHP/database noob

Chaosmeister commented 2 years ago

So I just tried to rename something with just viewer roles and was allowed to rename the attachments just fine - which should be corrected 😅

please check your ids, looks like your requested file and task are just not connected to each other

neotaburiss commented 2 years ago

Good news everyone, today I've updated my kanboard docker version from stable to nightly, then suddenly it works perfect.

Doubt there is some bug on current stable version updated 6 months ago and fixed now.

Looking forward your attachement hook code could be merged soon

Chaosmeister commented 2 years ago

yay nice to hear

the hook got merged already, so you should be able to rename documents as well by now, if you update the plugin as well