Browse Source

refactor(nextcloud): cleanup WebDavOptions

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/1159/head
Nikolas Rimikis 1 year ago
parent
commit
65c66f14e7
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 16
      packages/nextcloud/lib/src/webdav/client.dart
  2. 2
      packages/nextcloud/lib/src/webdav/webdav.dart

16
packages/nextcloud/lib/src/webdav/client.dart

@ -93,11 +93,12 @@ class WebDavClient {
'OPTIONS', 'OPTIONS',
_constructUri(), _constructUri(),
); );
final davCapabilities = response.headers['dav']?.first ?? '';
final davSearchCapabilities = response.headers['dasl']?.first ?? ''; final davCapabilities = response.headers['dav']?.first;
final davSearchCapabilities = response.headers['dasl']?.first;
return WebDavOptions( return WebDavOptions(
davCapabilities.split(',').map((final e) => e.trim()).where((final e) => e.isNotEmpty).toSet(), davCapabilities?.split(',').map((final e) => e.trim()).where((final e) => e.isNotEmpty).toSet(),
davSearchCapabilities.split(',').map((final e) => e.trim()).where((final e) => e.isNotEmpty).toSet(), davSearchCapabilities?.split(',').map((final e) => e.trim()).where((final e) => e.isNotEmpty).toSet(),
); );
} }
@ -347,9 +348,10 @@ class WebDavClient {
class WebDavOptions { class WebDavOptions {
/// Creates a new WebDavStatus. /// Creates a new WebDavStatus.
WebDavOptions( WebDavOptions(
this.capabilities, final Set<String>? capabilities,
this.searchCapabilities, final Set<String>? searchCapabilities,
); ) : capabilities = capabilities ?? {},
searchCapabilities = searchCapabilities ?? {};
/// DAV capabilities as advertised by the server in the 'dav' header. /// DAV capabilities as advertised by the server in the 'dav' header.
Set<String> capabilities; Set<String> capabilities;

2
packages/nextcloud/lib/src/webdav/webdav.dart

@ -17,7 +17,7 @@ const namespaceNextcloud = 'http://nextcloud.org/ns';
const namespaceOpenCollaborationServices = 'http://open-collaboration-services.org/ns'; const namespaceOpenCollaborationServices = 'http://open-collaboration-services.org/ns';
const namespaceOpenCloudMesh = 'http://open-cloud-mesh.org/ns'; const namespaceOpenCloudMesh = 'http://open-cloud-mesh.org/ns';
final Map<String, String> namespaces = { const Map<String, String> namespaces = {
namespaceDav: 'd', namespaceDav: 'd',
namespaceOwncloud: 'oc', namespaceOwncloud: 'oc',
namespaceNextcloud: 'nc', namespaceNextcloud: 'nc',

Loading…
Cancel
Save