fix: make sure users cant send too large of a content
This commit is contained in:
parent
d7abd486b4
commit
4f81608303
@ -26,7 +26,7 @@ const postAction = (client: any, scopes: string[]) => {
|
|||||||
return async ({ request, cookies }: { request: Request, cookies: Cookies }) => {
|
return async ({ request, cookies }: { request: Request, cookies: Cookies }) => {
|
||||||
const form = await request.formData()
|
const form = await request.formData()
|
||||||
const author = form.get("author")?.toString().replace(/([^_a-z0-9]+)/gi, '')
|
const author = form.get("author")?.toString().replace(/([^_a-z0-9]+)/gi, '')
|
||||||
const content = form.get("content")?.toString()
|
const content = form.get("content")?.toString().substring(0, 512)
|
||||||
const scopedCookies = scopeCookies(cookies)
|
const scopedCookies = scopeCookies(cookies)
|
||||||
if (author === undefined || content === undefined) {
|
if (author === undefined || content === undefined) {
|
||||||
scopedCookies.set("sendError", "one of author or content fields are missing")
|
scopedCookies.set("sendError", "one of author or content fields are missing")
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
class="text-lg ml-0.5 bg-inherit resize-none text-shadow-white placeholder-shown:[text-shadow:none] [field-sizing:content]"
|
class="text-lg ml-0.5 bg-inherit resize-none text-shadow-white placeholder-shown:[text-shadow:none] [field-sizing:content]"
|
||||||
name="content"
|
name="content"
|
||||||
placeholder="say meow!"
|
placeholder="say meow!"
|
||||||
|
maxlength="512"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<p class="place-self-end text-sm font-monospace">
|
<p class="place-self-end text-sm font-monospace">
|
||||||
|
Loading…
Reference in New Issue
Block a user