Defect #26443

User link syntax (user:login) doesn't work for logins consisting of an email adress

Added by Mischa The Evil 4 months ago. Updated about 1 month ago.

Status:ConfirmedStart date:
Priority:NormalDue date:
Assignee:Marius BALTEANU% Done:

0%

Category:Text formatting
Target version:4.0.0
Resolution: Affected version:3.4.0

Description

From #4179#note-69:

Vu Anh wrote:

Seem it isn't working well with syntax "user:abc@example.com" (Login name contain "@" character)

I am able to confirm this issue. Important to note though, is that the short syntax (@login) works as it should.

I'll attach a patch which adds explicit test coverage for this issue. It showcases what works and, after re-enabling the commented-out assertions, what currently fails.

Patch and confirmation against source:/trunk@16479 (though it is present on 3.4.1 too).

Environment:

Environment:
  Redmine version                3.4.0.devel@r16479
  Ruby version                   2.3.3-p222 (2016-11-21) [x86_64-linux]
  Rails version                  4.2.8
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.8.8
  Git                            1.9.1
  Filesystem                     
Redmine plugins:
  no plugin installed

0001-Add-test-assertions-showcasing-the-issue.patch Magnifier (1.81 KB) Mischa The Evil, 2017-07-14 21:21

26443_fix_user_link_syntax.patch Magnifier (7.58 KB) Marius BALTEANU, 2017-08-06 09:53


Related issues

Related to Redmine - Feature #4179: Link to user in wiki syntax Closed 2009-11-08
Blocks Redmine - Defect #26507: "attachment:filename" link syntax would not work if the f... New

History

#1 Updated by Mischa The Evil 4 months ago

#2 Updated by Marius BALTEANU 4 months ago

Thanks Mischa for opening this issue. I've already started work to a fix, but I found another issue (user logins with non alphanumeric characters like ) on textile formatting and I need more time to fix all these issue. Unfortunately, only next week I'll have the time to continue work on this.

#3 Updated by Marius BALTEANU 4 months ago

  • File 26443_fix_user_link_syntax.patch added

The attached patch fixes both issues.

Because I couldn't modify the regex to ignore the emails that starts with "@" or "user:", I chose to use the same logic from markdown formatting also for textile.

@Mischa, when I've implemented this feature, I didn't take into consideration the format user:"".
@Jean-Philippe Lang, do you think that it'll be better to use the new method "restore_user_links!" also in the markdown/formatting.rb in order to avoid the almost duplicated regexes?

#4 Updated by Go MAEDA 4 months ago

  • Target version set to 3.4.3

The patch attached in #26443#note-3 fixes this issue properly on the current trunk and 3.4-stable.
Setting target version to 3.4.3.

#5 Updated by Go MAEDA 4 months ago

  • Blocks Defect #26507: "attachment:filename" link syntax would not work if the file name contains "@" added

#6 Updated by Jean-Philippe Lang 4 months ago

  • Assignee set to Marius BALTEANU

Marius BALTEANU wrote:

@Jean-Philippe Lang, do you think that it'll be better to use the new method "restore_user_links!" also in the markdown/formatting.rb in order to avoid the almost duplicated regexes?

That would be nice indeed if we can use the same method.

#7 Updated by Marius BALTEANU 4 months ago

  • File 26443_fix_user_link_syntax.patch added

Jean-Philippe Lang wrote:

That would be nice indeed if we can use the same method.

Here it is the new patch. I chose to move all the restore redmine links from markdown to the new method because I do not see any side effect.

I'll add a new patch soon that improves the existing tests in order to be sure that all redmine links work on each text formatting (none, textile, markdown).

#8 Updated by Marius BALTEANU 4 months ago

  • File deleted (26443_fix_user_link_syntax.patch)

#9 Updated by Marius BALTEANU 4 months ago

Attached the correct patch. The previous one has an undesired change.

#11 Updated by Marius BALTEANU 4 months ago

  • File deleted (26443_fix_user_link_syntax.patch)

#12 Updated by Marius BALTEANU about 1 month ago

Just a technical note: An interesting approach is the html-pipeline used by GitHub which easily allows you to apply different filters or transformations over the initial html. I like that the implementation looks very clean. Jean-Philippe Lang, do you find this approach interesting for a future implementation in Redmine? I can work on this, but I want a validation first :)

#13 Updated by Jean-Philippe Lang about 1 month ago

  • Target version changed from 3.4.3 to 4.0.0

Changes are rather large, setting target to a major version.

Also available in: Atom PDF