Browse Source

Merge pull request #970 from nextcloud/refactor/neon-account-url-completion

refactor(neon): Simplify completing URLs using the server URL
pull/974/head
Kate 1 year ago committed by GitHub
parent
commit
eb384c88c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      packages/neon/neon/lib/src/models/account.dart

12
packages/neon/neon/lib/src/models/account.dart

@ -95,13 +95,11 @@ class Account implements Credentials {
/// The paths of the [serverURL] and the [uri] need to be join to get the full path, unless the [uri] path is already an absolute path. /// The paths of the [serverURL] and the [uri] need to be join to get the full path, unless the [uri] path is already an absolute path.
/// In that case an instance hosted at a sub folder will already contain the sub folder part in the [uri]. /// In that case an instance hosted at a sub folder will already contain the sub folder part in the [uri].
Uri completeUri(final Uri uri) { Uri completeUri(final Uri uri) {
final result = serverURL.replace( final result = serverURL.resolveUri(uri);
queryParameters: uri.queryParameters, if (!uri.hasAbsolutePath) {
fragment: uri.fragment, return result.replace(path: '${serverURL.path}/${uri.path}');
); }
return result.replace( return result;
path: uri.hasAbsolutePath ? uri.path : '${result.path}/${uri.path}',
);
} }
/// Removes the [serverURL] part from the [uri]. /// Removes the [serverURL] part from the [uri].

Loading…
Cancel
Save