nextcloud / files_automatedtagging

:bookmark: An app for Nextcloud that assigns tags to newly uploaded files based on some conditions
https://apps.nextcloud.com/apps/files_automatedtagging
52 stars 23 forks source link

Parent folder of uploaded files and folders also gets tagged #92

Open thrdroom opened 4 years ago

thrdroom commented 4 years ago

I have the exact same problem as described in https://github.com/nextcloud/files_automatedtagging/issues/87 The "fix" suggested by @nickvergessen does not really solve the problem!

I need the ability to upload folders which automatically get tagged, as well as the option to exclude the parent folder from beeing automatically tagged. There should be either be an option to exclude the parent folder, or any folder a user wishes. Im not sure how the folders to be exlcuded should be selected/defined.

File MIME type > is not > httpd/unix-directory is not a real fix to this problem as it stopps the ability from folders beeing auto tagged and deleted inside the parent folder.

Steps to reproduce

  1. Set a tag "1dayRetention" to be automatically added to files and folders tagged with "parentfolder"
  2. Create folder "tempdir"
  3. Tag folder "tempdir" with tag "parentfolder"
  4. Upload files and folders into the folder "tempdir"

autodelete-retention

Expected behaviour

All files and folders which are uploaded to the parent directory called "tempdir" should be tagged with the tag "1dayRetention". But the parent directory called "tempdir" should not be tagged with the tag "1dayRetention"

tempdir/ [parentfolder] ├── project1/ [1dayRetention] │ ├── file1.txt [1dayRetention] │ ├── file2.txt [1dayRetention] ├── file3.txt [1dayRetention]

Actual behaviour

All files and folders which are uploaded to the parent directory called "tempdir" get tagged with the tag "1dayRetention" including the parent directory called "tempdir" itself. Which results in the deletion of the parent directory.

tempdir/ [parentfolder][1dayRetention] ├── project1/ [1dayRetention] │ ├── file1.txt [1dayRetention] │ ├── file2.txt [1dayRetention] ├── file3.txt [1dayRetention]

Server configuration

Operating system: Debian 10

Web server: Apache

Database: MariaDB

PHP version: 7.3.11

Nextcloud version: (see Nextcloud admin page) 17.0.1

Coernel82 commented 4 years ago

Bug confirmed using

nickvergessen commented 4 years ago

Well the main issue is that modifying a file also applies tags. Since the parent folders also get modified (last changed and size) they also get tagged.

Coernel82 commented 4 years ago

It used to be different. @nickvergessen it does absolutely makes sense what you say - undeniable Vulcan logic. So technically this is not a bug but a severe limitation. I'd be hapy if someone fixes this. I would but I am no programmer. I can offer a free singing lesson in Germany in exchange ;-)

nickvergessen commented 4 years ago

You wouldn't want to hear me trying to sing. It's on my head and in my mind, if I find a clever way to achieve it, it will get fixed. I suffered from the same issue on my instance, but i just excluded my folder names as a workaround, but that only works if you know all affectes folders 🙈

jernejs commented 4 years ago

I've got the same problem - been using automated tagging with retention plugin to automatically delete files from certain folders, but now the folders themselves get removed as well. Would it be at least possible to add a filter for folders in general?

Coernel82 commented 4 years ago

There is a workaround to exclude folders in general:

when accessing file and collobarative tag on file is tagged with <yourspecifictag(invisible)> and file MIME-Type is not user defined MIME-type httpd/unix-directory

then add tag <yourspecificdeletiontag>

The actual english word may differ - i translated from German.

sachilles commented 3 years ago

I can confirm the bug. Furthermore, the above mentioned workaround does not work for me.