Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1135)

Unified Diff: lib/src/source/hosted.dart

Issue 1664903003: Properly include the hosted URL in all IDs. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/descriptor.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/source/hosted.dart
diff --git a/lib/src/source/hosted.dart b/lib/src/source/hosted.dart
index 62832e9723007e1449efb306617f2cdb2e3fcc1e..e1cde6365633076f18ec3277d567c04fbb41c14c 100644
--- a/lib/src/source/hosted.dart
+++ b/lib/src/source/hosted.dart
@@ -80,7 +80,8 @@ class HostedSource extends CachedSource {
var pubspec = new Pubspec.fromMap(
map['pubspec'], systemCache.sources,
expectedName: ref.name, location: url);
- var id = idFor(ref.name, pubspec.version);
+ var id = idFor(ref.name, pubspec.version,
+ url: _serverFor(ref.description));
memoizePubspec(id, pubspec);
return id;
@@ -166,7 +167,7 @@ class HostedSource extends CachedSource {
packages.sort(Package.orderByNameAndVersion);
for (var package in packages) {
- var id = idFor(package.name, package.version);
+ var id = idFor(package.name, package.version, url: url);
try {
await _download(url, package.name, package.version, package.dir);
@@ -269,7 +270,9 @@ class OfflineHostedSource extends HostedSource {
versions = await listDir(dir).map((entry) {
var components = path.basename(entry).split("-");
if (components.first != ref.name) return null;
- return HostedSource.idFor(ref.name, new Version.parse(components.last));
+ return HostedSource.idFor(
+ ref.name, new Version.parse(components.last),
+ url: _serverFor(ref.description));
}).where((id) => id != null).toList();
} else {
versions = [];
@@ -352,6 +355,9 @@ Uri _makeUrl(description, String pattern(String server, String package)) {
return Uri.parse(pattern(server, package));
}
+/// Returns the server URL for [description].
+Uri _serverFor(description) => Uri.parse(_parseDescription(description).last);
+
/// Parses [id] into its server, package name, and version components, then
/// converts that to a Uri given [pattern].
///
« no previous file with comments | « no previous file | test/descriptor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698