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

[Improvement] Abnormal characters check #15824

Merged
merged 8 commits into from
Apr 12, 2024
Merged

[Improvement] Abnormal characters check #15824

merged 8 commits into from
Apr 12, 2024

Conversation

pinkfloyds
Copy link
Contributor

@pinkfloyds pinkfloyds commented Apr 10, 2024

Purpose of the pull request

resource center file path illegal character check filter ,added checkFilePath() in checkFullName()

Brief change log

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/CheckUtils.java

/**
     * regex FilePath check,only use a to z ,A to Z, 0 to 9, and _./- 
     *
     * @param str     input string
     * @return true if regex pattern is right, otherwise return false
     */
    public static boolean checkFilePath(String str) {
        return regexChecks(str, Constants.REGEX_FILE_PATH);
    }

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java

// abnormal characters check
        if (!checkFilePath(fullName)){
            log.error("fullName contains illegal characters");
            throw new ServiceException(Status.ILLEGAL_RESOURCE_PATH);
        }

Verify this pull request

Manually verified the change by testing locally.
Added test case testCheckFilePath in CheckUtilsTest.

pinkfloyds

This comment was marked as duplicate.

@caishunfeng caishunfeng added bug Something isn't working 3.2.2 labels Apr 10, 2024
caishunfeng
caishunfeng previously approved these changes Apr 10, 2024
Copy link
Contributor

@caishunfeng caishunfeng left a comment

Choose a reason for hiding this comment

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

LGTM

@pinkfloyds pinkfloyds changed the title abnormal characters check [Improvement] Abnormal characters check Apr 10, 2024
Copy link
Member

@SbloodyS SbloodyS left a comment

Choose a reason for hiding this comment

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

Please link this pr to your issue and fix CI. @pinkfloyds

Copy link
Contributor

@rickchengx rickchengx left a comment

Choose a reason for hiding this comment

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

Overall LGTM, please Run 'mvn spotless:apply' to fix the code style

@SbloodyS SbloodyS added this to the 3.2.2 milestone Apr 11, 2024
SbloodyS
SbloodyS previously approved these changes Apr 11, 2024
Copy link
Member

@SbloodyS SbloodyS left a comment

Choose a reason for hiding this comment

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

+1

@pinkfloyds pinkfloyds dismissed stale reviews from SbloodyS and caishunfeng via d5b5aec April 11, 2024 09:32
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 39.24%. Comparing base (883848f) to head (bccabc9).

❗ Current head bccabc9 differs from pull request most recent head 0b6806d. Consider uploading reports for the commit 0b6806d to get more accurate results

Files Patch % Lines
...heduler/api/service/impl/ResourcesServiceImpl.java 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev   #15824      +/-   ##
============================================
- Coverage     39.24%   39.24%   -0.01%     
  Complexity     4910     4910              
============================================
  Files          1323     1323              
  Lines         45187    45191       +4     
  Branches       4811     4812       +1     
============================================
+ Hits          17734    17735       +1     
- Misses        25572    25573       +1     
- Partials       1881     1883       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

sonarcloud bot commented Apr 12, 2024

@SbloodyS SbloodyS merged commit e5e7749 into apache:dev Apr 12, 2024
60 checks passed
ruanwenjun added a commit that referenced this pull request May 31, 2024
SbloodyS pushed a commit that referenced this pull request May 31, 2024
ruanwenjun added a commit to ruanwenjun/dolphinscheduler that referenced this pull request May 31, 2024
SbloodyS pushed a commit that referenced this pull request May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants