revert
This commit is contained in:
parent
6dcba72e1c
commit
0ea386effe
|
|
@ -436,9 +436,6 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||
if (isDuplicateKeyValueError(e)) {
|
||||
const err = new Error('Duplicated note');
|
||||
err.name = 'duplicated';
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
Object.defineProperty(err, 'stack', { value: '' });
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,28 +80,16 @@ export class ApNoteService {
|
|||
const expectHost = this.utilityService.extractDbHost(uri);
|
||||
|
||||
if (!validPost.includes(getApType(object))) {
|
||||
const error = new Error(`invalid Note: invalid object type ${getApType(object)}`);
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
Object.defineProperty(error, 'stack', { value: '' });
|
||||
}
|
||||
return error;
|
||||
return new Error(`invalid Note: invalid object type ${getApType(object)}`);
|
||||
}
|
||||
|
||||
if (object.id && this.utilityService.extractDbHost(object.id) !== expectHost) {
|
||||
const error = new Error(`invalid Note: id has different host. expected: ${expectHost}, actual: ${this.utilityService.extractDbHost(object.id)}`);
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
Object.defineProperty(error, 'stack', { value: '' });
|
||||
}
|
||||
return error;
|
||||
return new Error(`invalid Note: id has different host. expected: ${expectHost}, actual: ${this.utilityService.extractDbHost(object.id)}`);
|
||||
}
|
||||
|
||||
const actualHost = object.attributedTo && this.utilityService.extractDbHost(getOneApId(object.attributedTo));
|
||||
if (object.attributedTo && actualHost !== expectHost) {
|
||||
const error = new Error(`invalid Note: attributedTo has different host. expected: ${expectHost}, actual: ${actualHost}`);
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
Object.defineProperty(error, 'stack', { value: '' });
|
||||
}
|
||||
return error;
|
||||
return new Error(`invalid Note: attributedTo has different host. expected: ${expectHost}, actual: ${actualHost}`);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue