mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-09-14 22:55:29 +02:00
fix: handle prototype property names in repository trees
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"core.min.js": "core.6332b3c288.min.js",
|
"core.min.js": "core.6332b3c288.min.js",
|
||||||
"vendor.min.js": "vendor.3340ba0f11.min.js",
|
"vendor.min.js": "vendor.a5d94d956f.min.js",
|
||||||
"mermaid.min.js": "mermaid.f848a72d16.min.js",
|
"mermaid.min.js": "mermaid.f848a72d16.min.js",
|
||||||
"all.min.css": "all.99ce8f3e14.min.css"
|
"all.min.css": "all.99ce8f3e14.min.css"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ angular
|
|||||||
function ($element, $scope, $routeParams, $compile) {
|
function ($element, $scope, $routeParams, $compile) {
|
||||||
$scope.repoId = document.location.pathname.split("/")[2];
|
$scope.repoId = document.location.pathname.split("/")[2];
|
||||||
|
|
||||||
$scope.opens = {};
|
$scope.opens = Object.create(null);
|
||||||
|
|
||||||
if ($routeParams.path) {
|
if ($routeParams.path) {
|
||||||
let accumulatedPath = "";
|
let accumulatedPath = "";
|
||||||
@@ -538,7 +538,8 @@ angular
|
|||||||
|
|
||||||
const toArray = function (arr) {
|
const toArray = function (arr) {
|
||||||
const output = [];
|
const output = [];
|
||||||
const keys = { "": { child: output } };
|
const keys = Object.create(null);
|
||||||
|
keys[""] = { child: output };
|
||||||
function ensurePath(path) {
|
function ensurePath(path) {
|
||||||
if (keys[path]) return;
|
if (keys[path]) return;
|
||||||
const segments = path.split("/");
|
const segments = path.split("/");
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -56,4 +56,14 @@ describe("frontend production regressions", function () {
|
|||||||
expect(template).to.include('ng-bind="treeNodes[0].name"');
|
expect(template).to.include('ng-bind="treeNodes[0].name"');
|
||||||
expect(h.scope.treeNodes[0].name).to.equal(h.scope.file[0].name);
|
expect(h.scope.treeNodes[0].name).to.equal(h.scope.file[0].name);
|
||||||
});
|
});
|
||||||
|
it("renders directories whose names collide with Object.prototype", function () {
|
||||||
|
const h = harness(); let template;
|
||||||
|
const element = { html() {}, 0: { addEventListener() {}, setAttribute() {} } };
|
||||||
|
h.scope.file = [{ name: "constructor", path: "" }, { name: "index.js", path: "constructor", size: 1 }];
|
||||||
|
h.scope.$parent = {};
|
||||||
|
h.defs.tree[0]().controller.at(-1)(element, h.scope, {}, html => { template = html; return () => {}; });
|
||||||
|
expect(() => h.watches.file(h.scope.file)).not.to.throw();
|
||||||
|
expect(template).to.include("treeNodes");
|
||||||
|
expect(h.scope.treeNodes[0].path).to.equal("/constructor/index.js");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user