Skip to content

Models called "File" cause an error on POST #2554

@DaGaMs

Description

@DaGaMs

I have a model called File and noticed a weird error when trying to POST to it:

{ error: 
   { name: 'Error',
     status: 500,
     message: 'Cannot create a file response from "object"',
     stack: 'Error: Cannot create a file response from "object"\n    at HttpContext.done ...

Renaming the model from File to afile or something like that fixes the issue. Here is a repo with a test case:

https://github.com/DaGaMs/loopback-file-bug-demo

It's really not ideal that loopback "clutters" the namespace for models like that. Both User and Change are reserved, and now it seems File is also a problem. It's a bit annoying to have to prefix my model names for that reason...


See #2554 (comment) for the proposed solution.

Tasks

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions