Updating nextcloud dependency, fixing upload and pub dep error

This commit is contained in:
2023-05-22 19:44:40 +02:00
parent 3adc3bcf88
commit 047282c5aa
4 changed files with 11 additions and 97 deletions

View File

@ -1,30 +0,0 @@
import 'dart:io';
import 'package:nextcloud/nextcloud.dart';
// NOT WORKING curl -H 'Transfer-Encoding: chunked' -H 'Content-Type: image/png' --compressed -u goldbaja -T /home/elias/Bilder/robotikmeme.png https://cloud.marianum-fulda.de/remote.php/webdav/some-image.png
// WORKS curl -H 'Transfer-Encoding: chunked' -H 'Content-Type: image/png' --compressed -u minetec -T /home/elias/Bilder/robotikmeme.png https://mhsl.eu/cloud/remote.php/webdav/some-image.png
void main() async {
print("HELLO WORLD");
WebDavClient client = NextcloudClient("https://cloud.marianum-fulda.de", username: "xxx", password: "xxx", loginName: "xxx").webdav;
final fileBytes = File("/home/elias/Bilder/robotikmeme.png").readAsBytesSync();
print(fileBytes.length);
HttpClientResponse response = await client.upload(fileBytes, "menue/test.png");
print(response.statusCode);
await Future.delayed(const Duration(seconds: 5)); // Wait a bit, just in case
final responses = (await client.ls(
'/menue/',
prop: WebDavPropfindProp.fromBools(
ocsize: true,
),
)).responses;
print("Filesize local: ${fileBytes.length}");
print("Filesize on Server: ${responses.singleWhere((final response) => response.href!.endsWith('/menue/test.png')).propstats.first.prop.ocsize}");
}