mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-11-03 20:08:00 +00:00 
			
		
		
		
	Clarify absence and patch of URL field of OCShares
This commit is contained in:
		
							parent
							
								
									dda1429581
								
							
						
					
					
						commit
						ee726119cb
					
				@ -88,18 +88,18 @@ public class ShareToRemoteOperationResultParser {
 | 
				
			|||||||
                    if (shares != null) {
 | 
					                    if (shares != null) {
 | 
				
			||||||
                        for (OCShare share : shares) {
 | 
					                        for (OCShare share : shares) {
 | 
				
			||||||
                            resultData.add(share);
 | 
					                            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 &&
 | 
					                            if (share.getShareType() == ShareType.PUBLIC_LINK &&
 | 
				
			||||||
                                    (share.getShareLink() == null ||
 | 
					                                    (share.getShareLink() == null ||
 | 
				
			||||||
                                            share.getShareLink().length() <= 0) &&
 | 
					                                            share.getShareLink().length() <= 0) &&
 | 
				
			||||||
                                    share.getToken().length() > 0
 | 
					                                    share.getToken().length() > 0
 | 
				
			||||||
                                    ) {
 | 
					                                    ) {
 | 
				
			||||||
                                // TODO - deal with https://github.com/owncloud/android/issues/1811
 | 
					 | 
				
			||||||
                                if (mServerBaseUri != null) {
 | 
					                                if (mServerBaseUri != null) {
 | 
				
			||||||
                                    String sharingLinkPath = ShareUtils.getSharingLinkPath(mOwnCloudVersion);
 | 
					                                    String sharingLinkPath = ShareUtils.getSharingLinkPath(mOwnCloudVersion);
 | 
				
			||||||
                                    share.setShareLink(mServerBaseUri + sharingLinkPath + share.getToken());
 | 
					                                    share.setShareLink(mServerBaseUri + sharingLinkPath + share.getToken());
 | 
				
			||||||
                                } else {
 | 
					                                } else {
 | 
				
			||||||
                                    Log_OC.e(TAG, "Couldn't build link for public share");
 | 
					                                    Log_OC.e(TAG, "Couldn't build link for public share :(");
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 | 
				
			|||||||
@ -253,6 +253,9 @@ public class ShareXMLParser {
 | 
				
			|||||||
				share.setIdRemoteShared(Integer.parseInt(value));
 | 
									share.setIdRemoteShared(Integer.parseInt(value));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			} else if (name.equalsIgnoreCase(NODE_URL)) {
 | 
								} 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);
 | 
									share.setShareType(ShareType.PUBLIC_LINK);
 | 
				
			||||||
				String value = readNode(parser, NODE_URL);
 | 
									String value = readNode(parser, NODE_URL);
 | 
				
			||||||
				share.setShareLink(value);
 | 
									share.setShareLink(value);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user