mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-11-03 20:08:00 +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:
		
						commit
						ae2f5b48b8
					
				@ -42,7 +42,8 @@ public class WebdavUtils {
 | 
				
			|||||||
            new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US),
 | 
					            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("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US),
 | 
				
			||||||
            new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", 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() {
 | 
					    public static String prepareXmlForPropFind() {
 | 
				
			||||||
        String ret = "<?xml version=\"1.0\" ?><D:propfind xmlns:D=\"DAV:\"><D:allprop/></D:propfind>";
 | 
					        String ret = "<?xml version=\"1.0\" ?><D:propfind xmlns:D=\"DAV:\"><D:allprop/></D:propfind>";
 | 
				
			||||||
 | 
				
			|||||||
@ -116,6 +116,10 @@ public class GetRemoteSharesForFileOperation extends RemoteOperation {
 | 
				
			|||||||
					result = new RemoteOperationResult(ResultCode.OK);
 | 
										result = new RemoteOperationResult(ResultCode.OK);
 | 
				
			||||||
					ArrayList<Object> sharesObjects = new ArrayList<Object>();
 | 
										ArrayList<Object> sharesObjects = new ArrayList<Object>();
 | 
				
			||||||
					for (OCShare share: mShares) {
 | 
										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);
 | 
											sharesObjects.add(share);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					result.setData(sharesObjects);
 | 
										result.setData(sharesObjects);
 | 
				
			||||||
 | 
				
			|||||||
@ -36,4 +36,7 @@ public class ShareUtils {
 | 
				
			|||||||
	// OCS Route
 | 
						// OCS Route
 | 
				
			||||||
	public static final String SHARING_API_PATH ="/ocs/v1.php/apps/files_sharing/api/v1/shares"; 
 | 
						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=";
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -35,6 +35,7 @@ import org.xmlpull.v1.XmlPullParserFactory;
 | 
				
			|||||||
import android.util.Log;
 | 
					import android.util.Log;
 | 
				
			||||||
import android.util.Xml;
 | 
					import android.util.Xml;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.owncloud.android.lib.common.network.WebdavUtils;
 | 
				
			||||||
import com.owncloud.android.lib.resources.files.FileUtils;
 | 
					import com.owncloud.android.lib.resources.files.FileUtils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -311,8 +312,8 @@ public class ShareXMLParser {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			} else if (name.equalsIgnoreCase(NODE_EXPIRATION)) {
 | 
								} else if (name.equalsIgnoreCase(NODE_EXPIRATION)) {
 | 
				
			||||||
				String value = readNode(parser, NODE_EXPIRATION);
 | 
									String value = readNode(parser, NODE_EXPIRATION);
 | 
				
			||||||
				if (!value.isEmpty()) {
 | 
									if (!(value.length() == 0)) {
 | 
				
			||||||
					share.setExpirationDate(Long.parseLong(readNode(parser, NODE_EXPIRATION))); // check if expiration is in long format or date format
 | 
										share.setExpirationDate(WebdavUtils.parseResponseDate(value).getTime()); 
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			} else if (name.equalsIgnoreCase(NODE_TOKEN)) {
 | 
								} else if (name.equalsIgnoreCase(NODE_TOKEN)) {
 | 
				
			||||||
@ -402,4 +403,5 @@ public class ShareXMLParser {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user