mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44: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"
|
||||
|
||||
get = {
|
||||
"/uploads/:id": (req, res) => {
|
||||
const filePath = path.join(global.uploadPath, req.params?.id)
|
||||
"/uploads/:id": {
|
||||
enabled: false,
|
||||
fn: (req, res) => {
|
||||
const filePath = path.join(global.uploadPath, req.params?.id)
|
||||
|
||||
const readStream = fs.createReadStream(filePath)
|
||||
const passTrough = new stream.PassThrough()
|
||||
const readStream = fs.createReadStream(filePath)
|
||||
const passTrough = new stream.PassThrough()
|
||||
|
||||
stream.pipeline(readStream, passTrough, (err) => {
|
||||
if (err) {
|
||||
return res.status(400)
|
||||
}
|
||||
})
|
||||
stream.pipeline(readStream, passTrough, (err) => {
|
||||
if (err) {
|
||||
return res.status(400)
|
||||
}
|
||||
})
|
||||
|
||||
return passTrough.pipe(res)
|
||||
return passTrough.pipe(res)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
post = {
|
||||
"/upload": {
|
||||
enabled: false,
|
||||
middlewares: ["withAuthentication", "fileUpload"],
|
||||
fn: async (req, res) => {
|
||||
const urls = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user