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:
parent
324ff0db64
commit
c29f0977d5
|
@ -113,7 +113,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
||||||
}
|
}
|
||||||
public String getDevelopmentUser() {
|
public String getDevelopmentUser() {
|
||||||
String user = TEST_USER;
|
String user = TEST_USER;
|
||||||
// user = "massimiliano.assante";
|
user = "massimiliano.assante";
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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
|
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");
|
_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("/"));
|
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;
|
imageUrl= imageFolder + "/" + imageUrl;
|
||||||
}
|
}
|
||||||
else if (!imageUrl.startsWith("http") ) { //e.g. http://adomain.com/anImage.png
|
else if (!imageUrl.startsWith("http") ) { //e.g. http://adomain.com/anImage.png
|
||||||
|
|
Loading…
Reference in New Issue