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

fix(code-editor): allow folder in file names #5620

Merged
merged 1 commit into from
Nov 1, 2021
Merged

Conversation

allardy
Copy link
Member

@allardy allardy commented Nov 1, 2021

Description

Not possible to add a folder when creating a file on the code editor. This had a bit more implications than just changing the regex, since we had to add some sanitization to the provided path to ensure someone can't climb up in the folder hierarchy.

This also secures more the "raw" access

Before:

image

After:
image

Fixes # https://linear.app/botpress/issue/DEV-1222/[bug]-unable-to-create-folders-for-actions-in-the-code-editor

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

Added tests

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • I've included some media (picture/gif/video) if applicable to show the old and new behavior

Copy link
Contributor

@ptrckbp ptrckbp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simplify and go with filepaths rather than path | file? I ask because of this test expect(isValid('file.js', 'path')).toEqual(true).

Copy link
Contributor

@ptrckbp ptrckbp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it out locally and it seems to work well. If you want to keep the "non-path" functionality, there is only the linter warnings, and I don't see any other issues.

@allardy allardy merged commit 0bc6b1a into x-meta Nov 1, 2021
@franklevasseur franklevasseur mentioned this pull request Nov 3, 2021
This was referenced Dec 2, 2021
@allardy allardy deleted the ya-fix-code-editor branch December 9, 2021 05:51
@crochcunill
Copy link

Solved in 12.6.7
Test case https://github.com/botpress/Testing/discussions/38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants