Skip to content

Commit fcc5a71

Browse files
Revert #684
Signed-off-by: Joas Schilling <[email protected]> Signed-off-by: nextcloud-command <[email protected]>
1 parent cd43f37 commit fcc5a71

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/Components/TraceLine.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class Argument extends Component {
4747
return (
4848
<span className={style.argument}
4949
title={showInline ? null : fancyFormatted}>
50-
{showInline ? baseFormatted : `${baseFormatted.slice(0, 12)} ... ${baseFormatted.slice(-2)}`}
50+
{showInline ? baseFormatted : `${baseFormatted.substr(0, 12)} ... ${baseFormatted.substr(baseFormatted.length - 2, 2)}`}
5151
</span>
5252
)
5353
}

src/ExceptionParser.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ export class ExceptionParser {
1414
}
1515

1616
isOldStyleException (logMessage) {
17-
return logMessage.substr && logMessage.slice(0, 12) === 'Exception: {';
17+
return logMessage.substr && logMessage.substr(0, 12) === 'Exception: {';
1818
}
1919

2020
isBackgroundJobException (logMessage) {
21-
return logMessage.substr && logMessage.slice(0, 34) === 'Error while running background job' && logMessage.indexOf('{"Exception":') !== -1;
21+
return logMessage.substr && logMessage.substr(0, 34) === 'Error while running background job' && logMessage.indexOf('{"Exception":') !== -1;
2222
}
2323

2424
parse (logMessage) {
@@ -28,20 +28,20 @@ export class ExceptionParser {
2828
let data;
2929
if (this.isOldStyleException(logMessage)) {
3030
try {
31-
data = this.tryParseJSON(logMessage.slice(10));
31+
data = this.tryParseJSON(logMessage.substr(10));
3232
} catch (e) {
3333
console.log('Error while parsing exception:');
34-
console.log(logMessage.slice(10));
34+
console.log(logMessage.substr(10));
3535
console.error(e);
3636
}
3737
} else {
38-
data = this.tryParseJSON(logMessage.slice(logMessage.indexOf('{"Exception":')));
39-
const messageHead = logMessage.substring(0, logMessage.indexOf('{"Exception":'));
38+
data = this.tryParseJSON(logMessage.substr(logMessage.indexOf('{"Exception":')));
39+
const messageHead = logMessage.substr(0, logMessage.indexOf('{"Exception":'));
4040
const jobDataString = messageHead.split('(', 2)[1];
4141
const jobDataParts = jobDataString.split(',', 2).map(part => part.trim());
4242
data.jobClass = jobDataParts[0].split(':', 2)[1].trim();
43-
data.jobArguments = jobDataParts[1].slice(10).trim();
44-
window.s = jobDataParts[1].slice(10).trim();
43+
data.jobArguments = jobDataParts[1].substr(10).trim();
44+
window.s = jobDataParts[1].substr(10).trim();
4545
if (data.jobClass === 'OC\\Command\\CommandJob') {
4646
try {
4747
[data.jobClass, data.jobArguments] = this.parseCommandJob(data.jobArguments);
@@ -94,7 +94,7 @@ export class ExceptionParser {
9494
} else {
9595
let filePaths = fileAndLine.split('(', 2);
9696
file = filePaths[0];
97-
lineNumber = filePaths[1].slice(0, -1);
97+
lineNumber = filePaths[1].substr(0, filePaths[1].length - 1);
9898
}
9999
return {
100100
'function': call,
@@ -134,7 +134,7 @@ export class ExceptionParser {
134134
const args = (trace.args || []).map(arg => {
135135
const baseFormatted = formatArgument(arg, 0).replace(/\n/g, '');;
136136
const showInline = baseFormatted.length < 42;
137-
return showInline ? baseFormatted : `${baseFormatted.slice(0, 16)} ... ${baseFormatted.slice(-2)}`;
137+
return showInline ? baseFormatted : `${baseFormatted.substr(0, 16)} ... ${baseFormatted.substr(baseFormatted.length - 2, 2)}`;
138138
});
139139
return `${' '.repeat(widestIndex - ('' + i).length)}${i}. ${fileAndLine(trace)}\n` +
140140
`${' '.repeat(widestIndex + 2)}${trace.class || ''}${trace.type || ''}${trace.function}(${args.join(', ')})`;

src/Providers/LogFile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export class LogFile extends LogProvider {
3232
// fix unescaped message json
3333
const startPos = json.indexOf('"message":"') + ('"message":"').length;
3434
const endPos = json.lastIndexOf('","level":');
35-
const start = json.slice(0, startPos);
36-
const end = json.slice(endPos);
37-
const message = json.slice(startPos, endPos);
35+
const start = json.substr(0, startPos);
36+
const end = json.substr(endPos);
37+
const message = json.substr(startPos, endPos - startPos);
3838

3939
const escapedMessage = message.replace(/([^\\]|^)["]/g, '$1\\"');
4040
json = start + escapedMessage + end;

src/unserialize.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export default function (phpstr) {
9292
case 's':
9393
var key = readString();
9494
if (key[key.length - 2] === '"') { // missing null bytes gives invalid length
95-
key = key.slice(0, -2);
95+
key = key.substr(0, key.length - 2);
9696
idx -= 2;
9797
}
9898
return key;
@@ -153,7 +153,7 @@ export default function (phpstr) {
153153
pos = parsedName.indexOf("\u0000", 1);
154154
if (pos > 0) {
155155
class_name = parsedName.substring(1, pos);
156-
prop_name = parsedName.slice(pos + 1);
156+
prop_name = parsedName.substr(pos + 1);
157157

158158
if ("*" === class_name) {
159159
// protected
@@ -181,8 +181,8 @@ export default function (phpstr) {
181181
// So, we can to lose something in any way.
182182
}
183183
}
184-
} else if (parsedName.slice(0, baseClassName.length) === baseClassName) { // private property with missing null bytes
185-
return baseClassName + '::' + parsedName.slice(baseClassName.length);
184+
} else if (parsedName.substr(0, baseClassName.length) === baseClassName) { // private property with missing null bytes
185+
return baseClassName + '::' + parsedName.substr(baseClassName.length);
186186
} else {
187187
// public "property"
188188
return parsedName;

0 commit comments

Comments
 (0)