mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-24 10:46:30 -05:00
Fix prettier errors
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
7960776bd1
commit
890e9c942b
4 changed files with 28 additions and 24 deletions
|
@ -17,21 +17,24 @@ import * as getRawBody from 'raw-body';
|
|||
*
|
||||
* Implementation inspired by https://stackoverflow.com/questions/52283713/how-do-i-pass-plain-text-as-my-request-body-using-nestjs
|
||||
*/
|
||||
export const MarkdownBody = createParamDecorator(async (_, context: ExecutionContext) => {
|
||||
// we have to check req.readable because of raw-body issue #57
|
||||
// https://github.com/stream-utils/raw-body/issues/57
|
||||
const req = context.switchToHttp().getRequest<import('express').Request>();
|
||||
// Here the Content-Type of the http request is checked to be text/markdown
|
||||
// because we dealing with markdown. Technically by now there can be any content which can be encoded.
|
||||
// There could be features in the software which do not work properly if the text can't be parsed as markdown.
|
||||
if (req.get('Content-Type') === 'text/markdown') {
|
||||
if (req.readable) {
|
||||
return (await getRawBody(req)).toString().trim();
|
||||
export const MarkdownBody = createParamDecorator(
|
||||
async (_, context: ExecutionContext) => {
|
||||
// we have to check req.readable because of raw-body issue #57
|
||||
// https://github.com/stream-utils/raw-body/issues/57
|
||||
const req = context.switchToHttp().getRequest<import('express').Request>();
|
||||
// Here the Content-Type of the http request is checked to be text/markdown
|
||||
// because we dealing with markdown. Technically by now there can be any content which can be encoded.
|
||||
// There could be features in the software which do not work properly if the text can't be parsed as markdown.
|
||||
if (req.get('Content-Type') === 'text/markdown') {
|
||||
if (req.readable) {
|
||||
return (await getRawBody(req)).toString().trim();
|
||||
} else {
|
||||
throw new InternalServerErrorException('Failed to parse request body!');
|
||||
}
|
||||
} else {
|
||||
throw new InternalServerErrorException('Failed to parse request body!');
|
||||
throw new BadRequestException(
|
||||
'Body Content-Type has to be text/markdown!',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
throw new BadRequestException('Body Content-Type has to be text/markdown!');
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
);
|
||||
|
|
|
@ -25,7 +25,7 @@ async function getServerVersionFromPackageJson() {
|
|||
const packageInfo: { version: string } = JSON.parse(rawFileContent);
|
||||
const versionParts: number[] = packageInfo.version
|
||||
.split('.')
|
||||
.map((x) => parseInt(x, 10));
|
||||
.map(x => parseInt(x, 10));
|
||||
versionCache = {
|
||||
major: versionParts[0],
|
||||
minor: versionParts[1],
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
Column, CreateDateColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
ManyToMany,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn, UpdateDateColumn,
|
||||
PrimaryGeneratedColumn,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm/index';
|
||||
import { User } from '../users/user.entity';
|
||||
import { Revision } from './revision.entity';
|
||||
|
@ -38,14 +40,14 @@ export class Authorship {
|
|||
user: User;
|
||||
|
||||
@Column()
|
||||
startPos: number
|
||||
startPos: number;
|
||||
|
||||
@Column()
|
||||
endPos: number
|
||||
endPos: number;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date
|
||||
createdAt: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,6 @@ describe('Notes', () => {
|
|||
expect(historyEntry.pinStatus).toEqual(true);
|
||||
});
|
||||
|
||||
|
||||
it.skip(`GET /me/notes/`, async () => {
|
||||
// TODO use function from HistoryService to add an History Entry
|
||||
await notesService.createNote('This is a test note.', 'test7');
|
||||
|
|
Loading…
Reference in a new issue