[xwiki-users] Watchlist App Email Notification generates incorrect document links
Clemens Klein-Robbenhaar
c.robbenhaar at espresto.com
Mon Feb 16 10:47:44 UTC 2015
Hi Alexander,
I just have been able to reproduce the issue with the jetty-hsql package of XWiki 6.4.1
after a few modifications - it looks like a bug still running around in the wild.
What you can do about it is:
- create a bug report in http://jira.xwiki.org/
- if you want to debug it, ( http://dev.xwiki.org/xwiki/bin/view/Community/Debugging )
pointers in the code are:
the scheduler (which triggers the watchlist mails) constructs a "dummy-request" at startup to be able to figure out the right url in background threads:
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-scheduler/xwiki-platform-scheduler-api/src/main/java/com/xpn/xwiki/plugin/scheduler/SchedulerPlugin.java#L226
the watchlist notifier then passes through the dummy request (contained on context.getRequest()) to the mails sender module
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-watchlist/xwiki-platform-watchlist-api/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListNotifier.java#L82
the mail sender module uses an "ExternalURLFactory" to make sure the urls in the mail are absolute:
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-mailsender/src/main/java/com/xpn/xwiki/plugin/mailsender/MailSenderPlugin.java#L803
Somewhere along these lines the problem lurks.
In my installation I checked that the "Send Page by mail" feature does not have the problem, so I think it is not in the mails sender module, but earlier - just a guess
- unless the bug is fixed, add a rewrite rule to the nginx
redirecting urls starting with /bin/bin/... to /bin/...
which should work around the problem.
Cheers,
Clemens
> Hi all,
>
> I have noticed that XWiki 6.1 generates incorrect document link in
> notification mails in our setup.
> It duplicates /bin path element into /bin/bin in every link.
>
> I've searched the mailing list and could only found this thread:
> http://lists.xwiki.org/pipermail/users/2011-July/020402.html
> with an almost identical description:
>
>>>>>>>>> * duplicated "/bin/" element in link URL
> *>>>>* e.g. http://subwiki.server.com/bin/bin/view/SpaceName/PageName
> <http://subwiki.server.com/bin/bin/view/SpaceName/PageName>
> *>>>
>
> Unfortunately, the problem hasn't been solved and no other discussions were
> seen on this topic.
>
> Here are more details about our installation:
> * XWiki 6.1 (and recently tried 6.4.1 with the same result)
> * Tomcat7 container running ROOT.war with XWiki application on
> http://localhost:8080/
> * xwiki.cfg contains xwiki.home uncommented and set to a correct public URL
> (https://ourserver.com/)
> * Nginx frontend using proxy_pass to serve the public URL
>
> I have also noticed that links to the same pages in emails sent by "Share
> by email" extension are correct (no /bin duplication).
>
> We are using XWiki as a corporate knowledge base, so the correctness of
> email notifications are important for us.
> Any help will be appreciated.
>
More information about the users
mailing list