mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-02 06:46:22 +01:00
Ensure File path not starting with /
This commit is contained in:
parent
275603d88a
commit
a429fbe006
2 changed files with 13 additions and 1 deletions
|
@ -195,7 +195,7 @@ class File with EquatableMixin {
|
|||
this.hasPreview,
|
||||
this.fileId,
|
||||
this.metadata,
|
||||
}) : this.path = path.trimRightAny("/");
|
||||
}) : this.path = path.trimAny("/");
|
||||
|
||||
factory File.fromJson(Map<String, dynamic> json) {
|
||||
return File(
|
||||
|
|
|
@ -327,6 +327,18 @@ void main() {
|
|||
});
|
||||
|
||||
group("File", () {
|
||||
group("constructor", () {
|
||||
test("path trim slash", () {
|
||||
final file = File(path: "/remote.php/dav/");
|
||||
expect(file.path, "remote.php/dav");
|
||||
});
|
||||
|
||||
test("path slash only", () {
|
||||
final file = File(path: "/");
|
||||
expect(file.path, "");
|
||||
});
|
||||
});
|
||||
|
||||
group("fromJson", () {
|
||||
test("path", () {
|
||||
final json = <String, dynamic>{
|
||||
|
|
Loading…
Reference in a new issue