Skip to content

Commit eb384c8

Browse files
Merge pull request #970 from nextcloud/refactor/neon-account-url-completion
refactor(neon): Simplify completing URLs using the server URL
2 parents 4af1438 + 2aa44fe commit eb384c8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,11 @@ class Account implements Credentials {
9595
/// 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.
9696
/// In that case an instance hosted at a sub folder will already contain the sub folder part in the [uri].
9797
Uri completeUri(final Uri uri) {
98-
final result = serverURL.replace(
99-
queryParameters: uri.queryParameters,
100-
fragment: uri.fragment,
101-
);
102-
return result.replace(
103-
path: uri.hasAbsolutePath ? uri.path : '${result.path}/${uri.path}',
104-
);
98+
final result = serverURL.resolveUri(uri);
99+
if (!uri.hasAbsolutePath) {
100+
return result.replace(path: '${serverURL.path}/${uri.path}');
101+
}
102+
return result;
105103
}
106104

107105
/// Removes the [serverURL] part from the [uri].

0 commit comments

Comments
 (0)