fixed bug in html links preview

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@95524 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-05-09 15:46:18 +00:00
parent 324ff0db64
commit c29f0977d5
2 changed files with 10 additions and 2 deletions

View File

@ -113,7 +113,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
}
public String getDevelopmentUser() {
String user = TEST_USER;
// user = "massimiliano.assante";
user = "massimiliano.assante";
return user;
}
/**

View File

@ -206,8 +206,16 @@ public class TextTransfromUtils {
}
else if (!imageUrl.contains("/") || !imageUrl.startsWith("/")) { //the image is probably in the same folder or in a path starting from the last slash
_log.trace("probably in the same folder");
// e.g. http://www.adomain.com/docrep/018/i3328e/i3328e00.htm?utm_source
// e.g. http://www.adomain.com/docrep/018/i3328e/i3328e00.htm?utm_source
String checkedURL = pageURL.toString();
if (! checkedURL.endsWith("/")) {
checkedURL+="/";
}
String imageFolder = pageURL.toString().substring(0, pageURL.toString().lastIndexOf("/"));
//it means the url was sth like http://www.asite.com without ending slash
if (imageFolder.compareToIgnoreCase("http:/") == 0 || imageFolder.compareToIgnoreCase("https:/") == 0) {
imageFolder = pageURL.toString();
}
imageUrl= imageFolder + "/" + imageUrl;
}
else if (!imageUrl.startsWith("http") ) { //e.g. http://adomain.com/anImage.png