Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336960

Summary: icon urls should be encoded
Product: [Technology] MPC Reporter: Benjamin Muskalla <b.muskalla>
Component: wizardAssignee: Nathan Gervais <nathan>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: greensopinion, nathan
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Benjamin Muskalla CLA 2011-02-11 11:19:45 EST
Currenlty the MPC doesn't encode the URL for icons and will fail to provide icons for some items.

Example: http://marketplace.eclipse.org/content/eclipse-color-theme

!ENTRY org.eclipse.epp.mpc.ui 4 4 2011-02-11 17:11:17.232
!MESSAGE Bad URI: http://marketplace.eclipse.org/sites/default/files/eclipse-color-theme-logo-mp (1).png
!STACK 0
java.net.URISyntaxException: Illegal character in path at index 78: http://marketplace.eclipse.org/sites/default/files/eclipse-color-theme-logo-mp (1).png
	at java.net.URI$Parser.fail(URI.java:2809)
	at java.net.URI$Parser.checkChars(URI.java:2982)
	at java.net.URI$Parser.parseHierarchical(URI.java:3066)
	at java.net.URI$Parser.parse(URI.java:3014)
	at java.net.URI.<init>(URI.java:578)
	at java.net.URL.toURI(URL.java:918)
	at org.eclipse.epp.internal.mpc.ui.catalog.AbstractResourceRunnable.run(AbstractResourceRunnable.java:63)
	at org.eclipse.epp.internal.mpc.ui.catalog.AbstractResourceRunnable.call(AbstractResourceRunnable.java:50)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
Comment 1 Nathan Gervais CLA 2011-02-11 11:47:08 EST
Sorry if this is obvious, but what do you mean by encode?

http://php.net/manual/en/function.htmlspecialchars.php

Would this help?
Comment 2 Benjamin Muskalla CLA 2011-02-11 11:57:41 EST
Sorry for the confusion: I think we should encode the url to eleminate non-conform chars like whitespaces (eg. " " -> %20)

Given the url: http://marketplace.eclipse.org/sites/default/files/eclipse-color-theme-logo-mp (1).png
Should to be: http://marketplace.eclipse.org/sites/default/files/eclipse-color-theme-logo-mp%20(1).png

For PHP, I'm pretty sure that http://php.net/manual/en/function.urlencode.php is what you're searching for.
Comment 3 Nathan Gervais CLA 2011-02-11 12:58:07 EST
Thanks for clearing that up

<image> tags now appear like

<image><![CDATA[http://marketplace.eclipse.org/sites%2Fdefault%2Ffiles%2Feclipse-color-theme-logo-mp%20%281%29.png]]></image>


http://marketplace.eclipse.org/content/eclipse-color-theme/api/p for reference.
Comment 4 Benjamin Muskalla CLA 2011-02-11 13:14:26 EST
It seems this is encoded a little too much :)

http://marketplace.eclipse.org/sites%2Fdefault%2Ffiles%2Feclipse-color-theme-logo-mp%20%281%29.png is not a valid url anymore (see http://httpd.apache.org/docs/2.2/mod/core.html#allowencodedslashes). This would also potentially break marketplace clients.

Nathan, I'd recommend to revert the changes and I'll try to solve this on the client-side.
Comment 5 David Green CLA 2011-02-14 15:19:35 EST
The server should be providing valid URLs (invalid characters should be encoded).
Comment 6 Nathan Gervais CLA 2011-02-14 15:30:57 EST
(In reply to comment #5)
> The server should be providing valid URLs (invalid characters should be
> encoded).

Would one of you mind looking at the current data sent back and let me know if there are other url fields that are returning the right data you expect?
Comment 7 Nathan Gervais CLA 2011-02-14 15:46:06 EST
Please ignore my last comment.

I believe I've found a solution for this.

http://marketplace.eclipse.org/content/eclipse-color-theme/api/p
Comment 8 Benjamin Muskalla CLA 2011-02-15 10:25:46 EST
Yep, url look sane now. Image of the Eclipse Color Theme appears correctly in MPC. Thanks Nathan. Will consider this as fixed.
Comment 9 Benjamin Muskalla CLA 2011-03-12 22:05:47 EST
*** Bug 310045 has been marked as a duplicate of this bug. ***