Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
2180f5bd
Unverified
Commit
2180f5bd
authored
2 years ago
by
Rhys Arkins
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(bundler): harden extract (#19839)
parent
3a6cfacf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/manager/bundler/extract.ts
+31
-4
31 additions, 4 deletions
lib/modules/manager/bundler/extract.ts
with
31 additions
and
4 deletions
lib/modules/manager/bundler/extract.ts
+
31
−
4
View file @
2180f5bd
...
@@ -73,8 +73,16 @@ export async function extractPackageFile(
...
@@ -73,8 +73,16 @@ export async function extractPackageFile(
while
(
lineNumber
<
lines
.
length
&&
groupLine
!==
'
end
'
)
{
while
(
lineNumber
<
lines
.
length
&&
groupLine
!==
'
end
'
)
{
lineNumber
+=
1
;
lineNumber
+=
1
;
groupLine
=
lines
[
lineNumber
];
groupLine
=
lines
[
lineNumber
];
// istanbul ignore if
if
(
!
is
.
string
(
groupLine
))
{
logger
.
warn
(
{
content
,
fileName
,
type
:
'
groupLine
'
},
'
Bundler parsing error
'
);
groupLine
=
'
end
'
;
}
if
(
groupLine
!==
'
end
'
)
{
if
(
groupLine
!==
'
end
'
)
{
groupContent
+=
formatContent
(
groupLine
||
''
);
groupContent
+=
formatContent
(
groupLine
);
}
}
}
}
const
groupRes
=
await
extractPackageFile
(
groupContent
);
const
groupRes
=
await
extractPackageFile
(
groupContent
);
...
@@ -104,8 +112,11 @@ export async function extractPackageFile(
...
@@ -104,8 +112,11 @@ export async function extractPackageFile(
lineNumber
+=
1
;
lineNumber
+=
1
;
sourceLine
=
lines
[
lineNumber
];
sourceLine
=
lines
[
lineNumber
];
// istanbul ignore if
// istanbul ignore if
if
(
sourceLine
===
null
||
sourceLine
===
undefined
)
{
if
(
!
is
.
string
(
sourceLine
))
{
logger
.
info
({
content
,
fileName
},
'
Undefined sourceLine
'
);
logger
.
warn
(
{
content
,
fileName
,
type
:
'
sourceLine
'
},
'
Bundler parsing error
'
);
sourceLine
=
'
end
'
;
sourceLine
=
'
end
'
;
}
}
if
(
sourceLine
!==
'
end
'
)
{
if
(
sourceLine
!==
'
end
'
)
{
...
@@ -135,6 +146,14 @@ export async function extractPackageFile(
...
@@ -135,6 +146,14 @@ export async function extractPackageFile(
while
(
lineNumber
<
lines
.
length
&&
platformsLine
!==
'
end
'
)
{
while
(
lineNumber
<
lines
.
length
&&
platformsLine
!==
'
end
'
)
{
lineNumber
+=
1
;
lineNumber
+=
1
;
platformsLine
=
lines
[
lineNumber
];
platformsLine
=
lines
[
lineNumber
];
// istanbul ignore if
if
(
!
is
.
string
(
platformsLine
))
{
logger
.
warn
(
{
content
,
fileName
,
type
:
'
platformsLine
'
},
'
Bundler parsing error
'
);
platformsLine
=
'
end
'
;
}
if
(
platformsLine
!==
'
end
'
)
{
if
(
platformsLine
!==
'
end
'
)
{
platformsContent
+=
formatContent
(
platformsLine
);
platformsContent
+=
formatContent
(
platformsLine
);
}
}
...
@@ -160,7 +179,15 @@ export async function extractPackageFile(
...
@@ -160,7 +179,15 @@ export async function extractPackageFile(
while
(
lineNumber
<
lines
.
length
&&
ifLine
!==
'
end
'
)
{
while
(
lineNumber
<
lines
.
length
&&
ifLine
!==
'
end
'
)
{
lineNumber
+=
1
;
lineNumber
+=
1
;
ifLine
=
lines
[
lineNumber
];
ifLine
=
lines
[
lineNumber
];
if
(
is
.
string
(
ifLine
)
&&
ifLine
!==
'
end
'
)
{
// istanbul ignore if
if
(
!
is
.
string
(
ifLine
))
{
logger
.
warn
(
{
content
,
fileName
,
type
:
'
ifLine
'
},
'
Bundler parsing error
'
);
ifLine
=
'
end
'
;
}
if
(
ifLine
!==
'
end
'
)
{
ifContent
+=
formatContent
(
ifLine
);
ifContent
+=
formatContent
(
ifLine
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment