Revision 975de248 src/gr/grnet/pithos/web/client/FileShareDialog.java
b/src/gr/grnet/pithos/web/client/FileShareDialog.java | ||
---|---|---|
234 | 234 |
Pithos.preventIESelection(); |
235 | 235 |
} |
236 | 236 |
}); |
237 |
publicPathText.setText(file.getPublicUri()); |
|
237 |
|
|
238 |
publicPathText.setText(""); // check: showLinkForPublicSharing(); |
|
238 | 239 |
publicPathText.setTitle("Use this link for sharing the file via e-mail, IM, etc. (crtl-C/cmd-C to copy to system clipboard)"); |
239 | 240 |
publicPathText.setReadOnly(true); |
240 | 241 |
publicPathPanel.add(publicPathText); |
... | ... | |
363 | 364 |
Pithos.preventIESelection(); |
364 | 365 |
} |
365 | 366 |
}); |
366 |
privatePathText.setText(Window.Location.getHost() + file.getPublicUri()); |
|
367 |
|
|
368 |
privatePathText.setText(""); // check: showLinkForPrivateSharing(); |
|
367 | 369 |
privatePathText.setTitle("Use this link for sharing the file via e-mail, IM, etc. (crtl-C/cmd-C to copy to system clipboard)"); |
368 | 370 |
privatePathText.setWidth(Const.PERCENT_100); |
369 | 371 |
privatePathText.setReadOnly(true); |
... | ... | |
406 | 408 |
|
407 | 409 |
private void showLinkForPublicSharing() { |
408 | 410 |
if (isFilePubliclyShared()) { |
409 |
UrlBuilder b = Window.Location.createUrlBuilder(); |
|
410 |
b.setPath(file.getPublicUri()); |
|
411 |
publicPathText.setText(b.buildString()); |
|
411 |
// Transitional: When the server returns the full URL in X-Object-Public, |
|
412 |
// just use it. |
|
413 |
final String filePublicURI = file.getPublicUri(); |
|
414 |
final String shownPublicURI; |
|
415 |
if(filePublicURI.toLowerCase().startsWith("http")) { |
|
416 |
shownPublicURI = filePublicURI; |
|
417 |
} |
|
418 |
else { |
|
419 |
UrlBuilder b = Window.Location.createUrlBuilder(); |
|
420 |
b.setPath(filePublicURI); |
|
421 |
shownPublicURI = b.buildString(); |
|
422 |
} |
|
423 |
|
|
424 |
publicPathText.setText(shownPublicURI); |
|
412 | 425 |
publicPathPanel.setVisible(true); |
413 | 426 |
} |
414 | 427 |
else { |
... | ... | |
418 | 431 |
|
419 | 432 |
private void showLinkForPrivateSharing() { |
420 | 433 |
if (isFilePrivatelyShared()) { |
421 |
UrlBuilder b = Window.Location.createUrlBuilder(); |
|
422 |
b.setPath(Pithos.getStorageAPIURL() + file.getOwnerID() + file.getUri()); |
|
434 |
final String fileViewURL = Pithos.getFileViewURL(file); |
|
435 |
final String shownViewURL; |
|
436 |
if(fileViewURL.toLowerCase().startsWith("http")) { |
|
437 |
shownViewURL = fileViewURL; |
|
438 |
} |
|
439 |
else { |
|
440 |
UrlBuilder b = Window.Location.createUrlBuilder(); |
|
441 |
b.setPath(fileViewURL); |
|
442 |
shownViewURL = b.buildString(); |
|
443 |
} |
|
444 |
|
|
423 | 445 |
String href = Window.Location.getHref(); |
424 | 446 |
boolean hasParameters = href.contains(Const.QUESTION_MARK); |
425 |
privatePathText.setText(href + (hasParameters ? Const.AMPERSAND : Const.QUESTION_MARK) + Const.GOTO_EQ + b.buildString());
|
|
447 |
privatePathText.setText(href + (hasParameters ? Const.AMPERSAND : Const.QUESTION_MARK) + Const.GOTO_EQ + shownViewURL);
|
|
426 | 448 |
privatePathPanel.setVisible(true); |
427 | 449 |
} |
428 | 450 |
else { |
Also available in: Unified diff