On Sunday, 25 May 2014, Oliver Gondža <notifications@github.com> wrote:

> In
> src/main/java/org/jenkinsci/plugins/mailwatcher/WatcherItemListener.java:
>
> > @@ -153,7 +155,19 @@ public void send(final Object o) {
> >                      recipients(property.getWatcherAddresses());
> >                  }
> >
> > -                url(job.getShortUrl());
> > +                Stack<String> stack = new Stack<String>();
> > +                stack.push(job.getShortUrl());
> > +                ItemGroup parent = job.getParent();
> > +                while (parent != null && parent instanceof Item) {
> > +                    Item item = (Item) parent;
> > +                    stack.push(item.getShortUrl());
> > +                    parent = item.getParent();
> > +                }
> > +                StringBuilder urlPath = new StringBuilder();
> > +                while (!stack.isEmpty()) {
> > +                    urlPath.append(stack.pop());
> > +                }
> > +                url(urlPath.toString());
> >                  name(job.getName());
>
> #getFullName() or #getFullDisplayName() should be used here.
>

Except IIUC they don't encode the URL components whereas shortUrl does, so
you'd need to split on / and then encode

There's a better helper method in newer versions of Jenkins but I didn't
want to do a version bump in this pull request


> —
> Reply to this email directly or view it on GitHub<https://github.com/jenkinsci/mail-watcher-plugin/pull/1/files#r13031920>
> .
>


-- 
Sent from my phone