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

Unified Diff: utils/pub/command_lish.dart

Issue 11558036: Don't try to put symlinked files in archive. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Handle file names that start with "..". Created 8 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/command_lish.dart
diff --git a/utils/pub/command_lish.dart b/utils/pub/command_lish.dart
index 420952c95a879fd98e9780457f2f833a9b8cbdec..01c03bca451451dd42ed3fa05a98ff456714829e 100644
--- a/utils/pub/command_lish.dart
+++ b/utils/pub/command_lish.dart
@@ -15,6 +15,7 @@ import 'git.dart' as git;
import 'io.dart';
import 'log.dart' as log;
import 'oauth2.dart' as oauth2;
+import 'path.dart' as path;
import 'pub.dart';
import 'validator.dart';
@@ -164,7 +165,20 @@ class LishCommand extends PubCommand {
// Should instead only make these relative right before generating
// the tree display (which is what really needs them to be).
// Make it relative to the package root.
- return relativeTo(entry, rootDir);
+ entry = relativeTo(entry, rootDir);
+
+ // TODO(rnystrom): dir.list() will include paths with resolved
+ // symlinks. In particular, we'll get paths to symlinked files from
+ // "packages" that reach outside of this package. Since the path
+ // has already been resolved, we don't even see "packages" in that
+ // path anymore.
+ // These should not be included in the archive. As a hack, ignore
+ // any file whose relative path is backing out of the root
+ // directory. Should do something cleaner.
+ var parts = path.split(entry);
+ if (!parts.isEmpty && parts[0] == '..') return null;
+
+ return entry;
});
}));
});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698