Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

fix for the public link when the server version is 8 #969

Merged
merged 3 commits into from
Nov 29, 2017
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Owncloud iOs Client/Utils/ShareUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ + (NSMutableArray *) manageTheDuplicatedUsers: (NSMutableArray*) items{

+ (NSURL *) getNormalizedURLOfShareLink:(OCSharedDto *)sharedLink {


NSString *urlSharedLink = sharedLink.url ? sharedLink.url : sharedLink.token;
NSString *urlSharedLink = (![sharedLink.url isEqual: @"(null)"]) ? sharedLink.url : sharedLink.token;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better not check with equal @"(null)" or not just only check that


NSString *url = nil;
// From ownCloud server 8.2 the url field is always set for public shares
Expand All @@ -64,11 +63,12 @@ + (NSURL *) getNormalizedURLOfShareLink:(OCSharedDto *)sharedLink {

if (firstNumber.integerValue >= k_server_version_with_new_shared_schema) {
// From ownCloud server version 8 on, a different share link scheme is used.
url = [NSString stringWithFormat:@"%@%@%@", APP_DELEGATE.activeUser.url, k_share_link_middle_part_url_after_version_8, sharedLink];
url = [NSString stringWithFormat:@"%@%@%@", APP_DELEGATE.activeUser.url, k_share_link_middle_part_url_after_version_8, urlSharedLink];
}else{
url = [NSString stringWithFormat:@"%@%@%@", APP_DELEGATE.activeUser.url, k_share_link_middle_part_url_before_version_8, sharedLink];
url = [NSString stringWithFormat:@"%@%@%@", APP_DELEGATE.activeUser.url, k_share_link_middle_part_url_before_version_8, urlSharedLink];
}
}
DLog(@"the url for the public link is %@",url);

return [NSURL URLWithString:url];
}
Expand Down