Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting content-type with extra file called *.js.* or *.ts.* then the app fails to start #17360

Open
derrickmehaffy opened this issue Jul 18, 2023 · 3 comments
Labels
flag: EE Issues correlates to internal EE ticket issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around source: core:content-type-builder Source is core/content-type-builder package source: core:strapi Source is core/strapi package status: confirmed Confirmed by a Strapi Team member or multiple community members

Comments

@derrickmehaffy
Copy link
Member

Bug report

Required System information

  • Node.js version: 18
  • NPM version: 8
  • Strapi version: 4.11.5
  • Database: SQLite
  • Operating system: Linux Mint 21.1
  • Is your project Javascript or Typescript: Javascript

Describe the bug

When you have an extra file that is named *.js.* or *.ts.* and delete the content-type via the content-type builder you will get an error that it can't find the content-type schema. Example would be: src/api/test/content-types/test/test.js.whatever

The server is restarting

Error: Could not load content type found at /home/dmehaffy/Development/deleteCT/src/api/test/content-types
    at loadContentTypes (/home/dmehaffy/Development/deleteCT/node_modules/@strapi/strapi/lib/core/loaders/apis.js:120:13)
    at async Promise.all (index 7)
    at async loadAPI (/home/dmehaffy/Development/deleteCT/node_modules/@strapi/strapi/lib/core/loaders/apis.js:73:5)
    at async module.exports [as loadAPIs] (/home/dmehaffy/Development/deleteCT/node_modules/@strapi/strapi/lib/core/loaders/apis.js:36:17)
    at async Strapi.loadAPIs (/home/dmehaffy/Development/deleteCT/node_modules/@strapi/strapi/lib/Strapi.js:353:5)
    at async Promise.all (index 4)
    at async Strapi.register (/home/dmehaffy/Development/deleteCT/node_modules/@strapi/strapi/lib/Strapi.js:381:5)
    at async Strapi.load (/home/dmehaffy/Development/deleteCT/node_modules/@strapi/strapi/lib/Strapi.js:491:5)
    at async workerProcess (/home/dmehaffy/Development/deleteCT/node_modules/@strapi/strapi/lib/commands/actions/develop/action.js:110:26)
Done in 16.51s.

Steps to reproduce the behavior

  1. Create a content-type and manually add a file with any name ending in .js.disabled into the content-types/CTName/ directory
  2. Start the server
  3. Use the CTB to try and delete the content-type
  4. See error

Expected behavior

Our file parser should not care if the file has a suffix and should delete the entire directory regardless

Screenshots

N/A

Code snippets

N/A

Additional context

Internal TID4347

@derrickmehaffy derrickmehaffy added issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around status: confirmed Confirmed by a Strapi Team member or multiple community members source: core:strapi Source is core/strapi package source: core:content-type-builder Source is core/content-type-builder package flag: EE Issues correlates to internal EE ticket labels Jul 18, 2023
@amanmalh
Copy link
Contributor

amanmalh commented Sep 9, 2023

Hi @derrickmehaffy, this condition is preventing any file other than <content-type>.<extension> or schema.json from being deleted (not just *.js.* or *.ts.* files as mentioned on the issue). Is there any particular file we want to prevent from being deleted? Else, we can remove this condition altogether to delete the entire directory.

@amanmalh
Copy link
Contributor

Hi @derrickmehaffy how should we proceed on this?

@derrickmehaffy
Copy link
Member Author

We'll need to wait for an engineer to confirm it and start working on it.

@hanpaine hanpaine added flag: EE Issues correlates to internal EE ticket and removed flag: EE Issues correlates to internal EE ticket labels May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flag: EE Issues correlates to internal EE ticket issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around source: core:content-type-builder Source is core/content-type-builder package source: core:strapi Source is core/strapi package status: confirmed Confirmed by a Strapi Team member or multiple community members
Projects
Status: To be reviewed (Open)
Development

No branches or pull requests

3 participants