mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 16:45:16 +00:00
Get basic post information
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { Response, Request } from "express";
|
||||
import { APIHelper } from "../helpers/APIHelper";
|
||||
import { APIClient } from "./APIClient";
|
||||
import { checkMail } from "../utils/StringUtils";
|
||||
import { checkMail, removeHTMLNodes } from "../utils/StringUtils";
|
||||
import { AccountHelper } from "../helpers/AccountHelper";
|
||||
import { UploadedFile } from "express-fileupload";
|
||||
import { prepareFileCreation, generateNewUserDataFileName, pathUserData } from "../utils/UserDataUtils";
|
||||
@ -81,6 +81,20 @@ export class RequestHandler {
|
||||
return this.hasPostParameter(name) && this.getPostParam(name).length >= minLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get some content for post and satinize it (remove HTML nodes)
|
||||
*
|
||||
* @param name The name of the POST field
|
||||
*/
|
||||
public postContent(name: string) : string {
|
||||
const content = this.postString(name);
|
||||
|
||||
if(content.match(/data:image/))
|
||||
this.error(401, "Please do not include inline images!");
|
||||
|
||||
return removeHTMLNodes(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an email address included in a post request
|
||||
*
|
||||
|
Reference in New Issue
Block a user