1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Clarify absence and patch of URL field of OCShares

This commit is contained in:
David A. Velasco 2017-04-26 13:48:22 +02:00
parent dda1429581
commit ee726119cb
2 changed files with 6 additions and 3 deletions

View File

@ -88,18 +88,18 @@ public class ShareToRemoteOperationResultParser {
if (shares != null) {
for (OCShare share : shares) {
resultData.add(share);
// build the share link if not in the response (only received when the share is created)
// build the share link if not in the response
// (needed for OC servers < 9.0.0, see ShareXMLParser.java#line256)
if (share.getShareType() == ShareType.PUBLIC_LINK &&
(share.getShareLink() == null ||
share.getShareLink().length() <= 0) &&
share.getToken().length() > 0
) {
// TODO - deal with https://github.com/owncloud/android/issues/1811
if (mServerBaseUri != null) {
String sharingLinkPath = ShareUtils.getSharingLinkPath(mOwnCloudVersion);
share.setShareLink(mServerBaseUri + sharingLinkPath + share.getToken());
} else {
Log_OC.e(TAG, "Couldn't build link for public share");
Log_OC.e(TAG, "Couldn't build link for public share :(");
}
}
}

View File

@ -253,6 +253,9 @@ public class ShareXMLParser {
share.setIdRemoteShared(Integer.parseInt(value));
} else if (name.equalsIgnoreCase(NODE_URL)) {
// NOTE: this field is received in all the public shares from OC 9.0.0
// in previous versions, it's received in the result of POST requests, but not
// in GET requests
share.setShareType(ShareType.PUBLIC_LINK);
String value = readNode(parser, NODE_URL);
share.setShareLink(value);