mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 19:14:16 +00:00
disable upload endpoints
This commit is contained in:
parent
dddee4009b
commit
f3f02e8095
@ -11,24 +11,28 @@ export default class FilesController extends ComplexController {
|
|||||||
static refName = "FilesController"
|
static refName = "FilesController"
|
||||||
|
|
||||||
get = {
|
get = {
|
||||||
"/uploads/:id": (req, res) => {
|
"/uploads/:id": {
|
||||||
const filePath = path.join(global.uploadPath, req.params?.id)
|
enabled: false,
|
||||||
|
fn: (req, res) => {
|
||||||
|
const filePath = path.join(global.uploadPath, req.params?.id)
|
||||||
|
|
||||||
const readStream = fs.createReadStream(filePath)
|
const readStream = fs.createReadStream(filePath)
|
||||||
const passTrough = new stream.PassThrough()
|
const passTrough = new stream.PassThrough()
|
||||||
|
|
||||||
stream.pipeline(readStream, passTrough, (err) => {
|
stream.pipeline(readStream, passTrough, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return res.status(400)
|
return res.status(400)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return passTrough.pipe(res)
|
return passTrough.pipe(res)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
post = {
|
post = {
|
||||||
"/upload": {
|
"/upload": {
|
||||||
|
enabled: false,
|
||||||
middlewares: ["withAuthentication", "fileUpload"],
|
middlewares: ["withAuthentication", "fileUpload"],
|
||||||
fn: async (req, res) => {
|
fn: async (req, res) => {
|
||||||
const urls = []
|
const urls = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user