diced / zipline

A ShareX/file upload server that is easy to use, packed with features, and with an easy setup!
https://zipline.diced.sh/
MIT License
1.32k stars 129 forks source link

Bug: Internal Server Error on viewing .cs file #266

Closed IceToast closed 1 year ago

IceToast commented 1 year ago

What happened?

The server responds with a 500 when trying to view a .cs file sometimes (~7/10 times).

Version

upstream (ghcr.io/diced/zipline:trunk)

What browser(s) are you seeing the problem on?

Chromium-based (Chrome, Edge, Brave, Opera, mobile chrome/chromium based, etc)

Zipline Logs

1|zipline  | warn  - You should not access 'res' after getServerSideProps resolves.
1|zipline  | Read more: https://nextjs.org/docs/messages/gssp-no-mutating-res
1|zipline  | TypeError: Cannot set properties of undefined (setting 'created_at')
1|zipline  |     at EmbeddedFile (/var/www/zipline/.next/server/pages/view/[id].js:192:22)
1|zipline  |     at renderWithHooks (/var/www/zipline/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5658:16)
1|zipline  |     at renderIndeterminateComponent (/var/www/zipline/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5731:15)
1|zipline  |     at renderElement (/var/www/zipline/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5946:7)
1|zipline  |     at renderNodeDestructiveImpl (/var/www/zipline/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11)
1|zipline  |     at renderNodeDestructive (/var/www/zipline/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14)
1|zipline  |     at renderNode (/var/www/zipline/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6259:12)
1|zipline  |     at renderChildrenArray (/var/www/zipline/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6211:7)
1|zipline  |     at renderNodeDestructiveImpl (/var/www/zipline/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6141:7)
1|zipline  |     at renderNodeDestructive (/var/www/zipline/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14)
1|zipline  | Warning: A title element received an array with more than 1 element as children. In browsers title Elements can only have Text Nodes as children. If the children being rendered output more than a single text node in aggregate the browser will display markup and comments as text in the title and hydration will likely fail and fall back to client rendering
1|zipline  |     at title
1|zipline  |     at head
1|zipline  |     at Head (/var/www/zipline/.next/server/chunks/56859.js:288:1)
1|zipline  |     at html
1|zipline  |     at Html (/var/www/zipline/.next/server/chunks/56859.js:676:104)
1|zipline  |     at MyDocument (/var/www/zipline/.next/server/pages/_document.js:24:1)
1|zipline  | warn  - You should not access 'res' after getServerSideProps resolves.
1|zipline  | Read more: https://nextjs.org/docs/messages/gssp-no-mutating-res
1|zipline  | warn  - You should not access 'res' after getServerSideProps resolves.
1|zipline  | Read more: https://nextjs.org/docs/messages/gssp-no-mutating-res
1|zipline  | warn  - You should not access 'res' after getServerSideProps resolves.
1|zipline  | Read more: https://nextjs.org/docs/messages/gssp-no-mutating-res
1|zipline  | warn  - You should not access 'res' after getServerSideProps resolves.
1|zipline  | Read more: https://nextjs.org/docs/messages/gssp-no-mutating-res
1|zipline  | warn  - You should not access 'res' after getServerSideProps resolves.
1|zipline  | Read more: https://nextjs.org/docs/messages/gssp-no-mutating-res
1|zipline  | warn  - You should not access 'res' after getServerSideProps resolves.
1|zipline  | Read more: https://nextjs.org/docs/messages/gssp-no-mutating-res
1|zipline  | warn  - You should not access 'res' after getServerSideProps resolves.
1|zipline  | Read more: https://nextjs.org/docs/messages/gssp-no-mutating-res
1|zipline  | warn  - You should not access 'res' after getServerSideProps resolves.
1|zipline  | Read more: https://nextjs.org/docs/messages/gssp-no-mutating-res

Browser Logs

No response

Additional Info

Repro:

diced commented 1 year ago

Was the file uploaded through the dashboard, if so was it through the text or file one?

If not was it just uploaded through something like sharex, curl, etc?

IceToast commented 1 year ago

Was the file uploaded through the dashboard, if so was it through the text or file one?

If not was it just uploaded through something like sharex, curl, etc?

The file was uploaded using ShareX and is being saved as mimetype "text/plain". I tried that because of code sharing (with syntax highlighting like when uploading JavaScript code)

When uploading it via the dashboard/files it's mimetype is set to "application/octet-stream" and will be downloaded when using the access link without showing the "view" page.

diced commented 1 year ago

Should be fixed https://github.com/diced/zipline/commit/e94dd58542b773537eb049e76b6e2bb836e03564