Skip to content

Commit 7439f13

Browse files
committed
wip nfc UserUploadLink urlPath; TODO checks-getter
1 parent eb828f4 commit 7439f13

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/model/internal_link.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class NarrowLink extends InternalLink {
133133
/// The structure mirrors the data required for [getFileTemporaryUrl]:
134134
/// https://zulip.com/api/get-file-temporary-url
135135
class UserUploadLink extends InternalLink {
136-
UserUploadLink(this.realmId, this.path, {required super.realmUrl});
136+
UserUploadLink(this.realmId, this.pathRest, {required super.realmUrl});
137137

138138
static UserUploadLink? _tryParse(String urlPath, Uri realmUrl) {
139139
final match = _urlPathRegexp.matchAsPrefix(urlPath);
@@ -145,6 +145,8 @@ class UserUploadLink extends InternalLink {
145145
static const _urlPathPrefix = '/user_uploads/';
146146
static final _urlPathRegexp = RegExp(r'^/user_uploads/(\d+)/(.+)$');
147147

148+
String get urlPath => '/user_uploads/$realmId/$pathRest';
149+
148150
final int realmId;
149151

150152
/// The remaining path components after the realm ID.
@@ -155,7 +157,7 @@ class UserUploadLink extends InternalLink {
155157
/// This corresponds to `filename` in the arguments to [getFileTemporaryUrl];
156158
/// but it's typically several path components,
157159
/// not just one as that name would suggest.
158-
final String path;
160+
final String pathRest;
159161
}
160162

161163
/// Try to parse the given URL as a page in this app, on `store`'s realm.

test/model/internal_link_test.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,7 @@ void main() {
608608
} else {
609609
check(result).isA<UserUploadLink>();
610610
result as UserUploadLink;
611-
final reconstructedPath = '/user_uploads/${result.realmId}/${result.path}';
612-
check(reconstructedPath).equals(urlPath);
611+
check(result.urlPath).equals(urlPath); // TODO checks-getter
613612
}
614613
});
615614
}

0 commit comments

Comments
 (0)