isomorphic-git 1.44.7 → 1.44.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +18 -6
- package/index.js +18 -6
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/managers/index.cjs +16 -4
- package/managers/index.js +16 -4
- package/managers/index.umd.min.js +1 -1
- package/managers/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/managers/index.cjs
CHANGED
|
@@ -3001,13 +3001,25 @@ class GitPktLine {
|
|
|
3001
3001
|
const reader = new StreamReader(stream);
|
|
3002
3002
|
return async function read() {
|
|
3003
3003
|
try {
|
|
3004
|
-
|
|
3005
|
-
if (
|
|
3006
|
-
|
|
3004
|
+
const header = await reader.read(4);
|
|
3005
|
+
if (header == null || header.length === 0) return true
|
|
3006
|
+
const hex = header.toString('utf8');
|
|
3007
|
+
if (!/^[0-9a-fA-F]{4}$/.test(hex)) {
|
|
3008
|
+
throw new ParseError('four hexadecimal digits', hex)
|
|
3009
|
+
}
|
|
3010
|
+
const length = parseInt(hex, 16);
|
|
3007
3011
|
if (length === 0) return null
|
|
3008
3012
|
if (length === 1) return null // delim packets
|
|
3013
|
+
if (length < 4) {
|
|
3014
|
+
throw new ParseError('pkt-line length of 0, 1, or at least 4', hex)
|
|
3015
|
+
}
|
|
3009
3016
|
const buffer = await reader.read(length - 4);
|
|
3010
|
-
if (buffer == null)
|
|
3017
|
+
if (buffer == null || buffer.length !== length - 4) {
|
|
3018
|
+
throw new ParseError(
|
|
3019
|
+
`${length - 4} bytes of pkt-line data`,
|
|
3020
|
+
`${buffer == null ? 0 : buffer.length} bytes`
|
|
3021
|
+
)
|
|
3022
|
+
}
|
|
3011
3023
|
return buffer
|
|
3012
3024
|
} catch (err) {
|
|
3013
3025
|
stream.error = err;
|
package/managers/index.js
CHANGED
|
@@ -2994,13 +2994,25 @@ class GitPktLine {
|
|
|
2994
2994
|
const reader = new StreamReader(stream);
|
|
2995
2995
|
return async function read() {
|
|
2996
2996
|
try {
|
|
2997
|
-
|
|
2998
|
-
if (
|
|
2999
|
-
|
|
2997
|
+
const header = await reader.read(4);
|
|
2998
|
+
if (header == null || header.length === 0) return true
|
|
2999
|
+
const hex = header.toString('utf8');
|
|
3000
|
+
if (!/^[0-9a-fA-F]{4}$/.test(hex)) {
|
|
3001
|
+
throw new ParseError('four hexadecimal digits', hex)
|
|
3002
|
+
}
|
|
3003
|
+
const length = parseInt(hex, 16);
|
|
3000
3004
|
if (length === 0) return null
|
|
3001
3005
|
if (length === 1) return null // delim packets
|
|
3006
|
+
if (length < 4) {
|
|
3007
|
+
throw new ParseError('pkt-line length of 0, 1, or at least 4', hex)
|
|
3008
|
+
}
|
|
3002
3009
|
const buffer = await reader.read(length - 4);
|
|
3003
|
-
if (buffer == null)
|
|
3010
|
+
if (buffer == null || buffer.length !== length - 4) {
|
|
3011
|
+
throw new ParseError(
|
|
3012
|
+
`${length - 4} bytes of pkt-line data`,
|
|
3013
|
+
`${buffer == null ? 0 : buffer.length} bytes`
|
|
3014
|
+
)
|
|
3015
|
+
}
|
|
3004
3016
|
return buffer
|
|
3005
3017
|
} catch (err) {
|
|
3006
3018
|
stream.error = err;
|