Skip to content

Commit

Permalink
fix: web reference path should now correctly return a path string
Browse files Browse the repository at this point in the history
  • Loading branch information
Salakar committed Dec 8, 2021
1 parent c33c3c9 commit f9995ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,6 @@ void runDatabaseTests() {
expect(rootRef.path, '/');
expect(rootRef.key, isNull);
expect(rootRef.parent, isNull);

// Actually test trying to use the root ref
// for https://github.com/FirebaseExtended/flutterfire/issues/7515
// to make sure it doesn't crash
await expectLater(
rootRef.update({
'foo': 'bar',
'flutter': 'bar',
'dart': 'bar',
}),
throwsA(
isA<FirebaseException>()
.having(
(error) => error.code,
'code',
'permission-denied',
)
.having(
(error) => error.message,
'message',
predicate(
(String message) =>
message.contains("doesn't have permission"),
),
),
),
);
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ class QueryWeb extends QueryPlatform {
return instance;
}

@override
String get path {
final refPath = Uri.parse(_queryDelegate.ref.toString()).path;
return refPath.isEmpty ? '/' : refPath;
}

@override
DatabaseReferencePlatform get ref =>
DatabaseReferenceWeb(_database, _queryDelegate.ref);
Expand Down

0 comments on commit f9995ce

Please sign in to comment.