nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.75k stars 4k forks source link

Workflowengine "The given regular expression is invalid" #23666

Open R0Wi opened 3 years ago

R0Wi commented 3 years ago

Steps to reproduce

  1. Create a new flow (concrete workflow app doesn't matter)
  2. Choose File MIME type
  3. Choose matches (or does not match)
  4. Choose PDF documents (or Folder)

image

Note: the filters for Images and Office Documents are working.

Expected behaviour

Workflow can be created

Actual behaviour

If i try to save the workflow an error message is raised "The given regular expression is invalid"

Server configuration

Operating system: Ubuntu 20.04

Web server: Apache2

Database: MySql 8.0

PHP version: 7.4

Nextcloud version: 20.0.1

Additional information

Currently there is also an open issue at https://github.com/R0Wi/workflow_ocr/issues/32 where multiple users reported this problem.

kesselb commented 3 years ago

Thanks for reporting :+1: I see the same issue on Nextcloud 19.

cc @juliushaertl @blizzz as 'httpd/unix-directory' is not a pattern they cannot use matches as operator. We should probably hide operators which are not compatible to each other. We have the same issue the other way around for File MIME type is Office Documents.

R0Wi commented 3 years ago

Hi since the number of reported issues at the workflow_ocr app regarding this problem is increasing i'd kindly like to ask what are the plans for this? If we like to implement https://github.com/nextcloud/server/issues/23666#issuecomment-716023060 i can try to do this if you're willing to accept my PR ? 😃

cc @juliushaertl @blizzz @kesselb

kesselb commented 3 years ago

can try to do this if you're willing to accept my PR

Cool :+1:

since the number of reported issues at the workflow_ocr app

A pinned FAQ issue might help with that. At least here at nextcloud/server it helps a bit.

R0Wi commented 3 years ago

A pinned FAQ issue might help with that. At least here at nextcloud/server it helps a bit.

Thanks for the hint, will give it a try 😄

So basically i'd implement it the following way (given that the first column is set to File MIME type):

Would that be the way to go @kesselb ?

blizzz commented 3 years ago

@R0Wi generally that sounds good to me.

On a second thought, it is quite technical for the end user. An admin might now about regex's and stuff, but for the average user "is (not)" or "matches (not)" or the meaning of it is black magic. The best way would be to eliminate the differences (only keep is _(not)) and figure out what is desired by testing the third columns value.

That would be a bigger change however, and not backportable. This is an advantage of your suggestion, so let's go with it.

Changing the UI more radically (it has effects on the backend bits, too) could be something for 22.

szaimen commented 3 years ago

I suppose this is still valid on NC21.0.2?

R0Wi commented 3 years ago

AFAIK unfortunately yes. Did not manage to create a PR, yet 😢

FernandoMarques-Santos commented 3 years ago

NC 21.0.3 Workflow OCR 1.21.1, the problem still persists.

The only way to deal with this, for now, is to remove the other conditional, in my case, it was file MIME = pdf. As I wanted it to ocr just files created/modified with 2ocr somewhere in its name (insert /2ocr/i in the box), it is usable for now.

github-cli commented 2 years ago

@kesselb did you ever get around to doing this? still seems to be an issue though luckily after reading this, changing it to "is" instead of matches works for me but the error is not very intuitive

szaimen commented 1 year ago

Hi, please update to 24.0.9 or better 25.0.3 and report back if it fixes the issue. Thank you!

My goal is to add a label like e.g. 25-feedback to this ticket of an up-to-date major Nextcloud version where the bug could be reproduced. However this is not going to work without your help. So thanks for all your effort!

If you don't manage to reproduce the issue in time and the issue gets closed but you can reproduce the issue afterwards, feel free to create a new bug report with up-to-date information by following this link: https://github.com/nextcloud/server/issues/new?assignees=&labels=bug%2C0.+Needs+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+

github-cli commented 1 year ago

I dont have an issue with this anymore in general as after reading all this back when I had the issue I just know what I need to click and what that error actually means... However I would love to help as far as I can... I just tested this on 25.0.3 and selected "matches" PDF and it tells me that the regular expression is invalid.

rotdrop commented 1 year ago

Actually, when you choose "custom MIME type" you are facing a similar error. But this is a bogus user-interface: the placeholder suggests that you just can add "e.g. http/unix-directory". However, the placeholder suggestion is wrong, you need to enter a full-fledged regular expression, i.e. http/unix-directory does not work, but something like |http/unix-directory|.

I have no problems with entering a regular expression, but neither the placeholder nor the cryptic error message The given regular expression is invalid are of any help for directing the struggling user into the right direction.

I experienced this with a up-to-date v25 NC. Screenshots are appended

Screenshot_20230302_205807 Screenshot_20230302_205852 Screenshot_20230302_210938

kgnfth commented 1 year ago

@rotdrop Thanks for the solution, i wasted 32 years of my life figuring this out.

Nils160988 commented 10 months ago

Still valid for NC 27.1.3