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

Merge pull request #17 from owncloud/share_link__reuse_link_shared_in_server

Some fixes in operation of Shares
This commit is contained in:
David A. Velasco 2014-03-20 17:37:30 +01:00
commit ae2f5b48b8
4 changed files with 13 additions and 3 deletions

View File

@ -42,7 +42,8 @@ public class WebdavUtils {
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US),
new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US),
new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US) };
new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US) ,
new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") };
public static String prepareXmlForPropFind() {
String ret = "<?xml version=\"1.0\" ?><D:propfind xmlns:D=\"DAV:\"><D:allprop/></D:propfind>";

View File

@ -116,6 +116,10 @@ public class GetRemoteSharesForFileOperation extends RemoteOperation {
result = new RemoteOperationResult(ResultCode.OK);
ArrayList<Object> sharesObjects = new ArrayList<Object>();
for (OCShare share: mShares) {
// Build the link
if (share.getToken().length() > 0) {
share.setShareLink(client.getBaseUri() + ShareUtils.SHARING_LINK_TOKEN + share.getToken());
}
sharesObjects.add(share);
}
result.setData(sharesObjects);

View File

@ -36,4 +36,7 @@ public class ShareUtils {
// OCS Route
public static final String SHARING_API_PATH ="/ocs/v1.php/apps/files_sharing/api/v1/shares";
// String to build the link with the token of a share: server address + "/public.php?service=files&t=" + token
public static final String SHARING_LINK_TOKEN = "/public.php?service=files&t=";
}

View File

@ -35,6 +35,7 @@ import org.xmlpull.v1.XmlPullParserFactory;
import android.util.Log;
import android.util.Xml;
import com.owncloud.android.lib.common.network.WebdavUtils;
import com.owncloud.android.lib.resources.files.FileUtils;
/**
@ -311,8 +312,8 @@ public class ShareXMLParser {
} else if (name.equalsIgnoreCase(NODE_EXPIRATION)) {
String value = readNode(parser, NODE_EXPIRATION);
if (!value.isEmpty()) {
share.setExpirationDate(Long.parseLong(readNode(parser, NODE_EXPIRATION))); // check if expiration is in long format or date format
if (!(value.length() == 0)) {
share.setExpirationDate(WebdavUtils.parseResponseDate(value).getTime());
}
} else if (name.equalsIgnoreCase(NODE_TOKEN)) {
@ -402,4 +403,5 @@ public class ShareXMLParser {
}
}
}
}