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

[Improvment] improve resource service response #15997

Closed
wants to merge 4 commits into from

Conversation

caishunfeng
Copy link
Contributor

Purpose of the pull request

Improve resource service response, avoid to use Result<Object>

Brief change log

ResourceService and ResourceServiceImpl

Verify this pull request

update the UT ResourcesServiceTest

SbloodyS
SbloodyS previously approved these changes May 15, 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.

LGTM.

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 fix the CI error

@caishunfeng caishunfeng changed the title [Improvment] improve resource service response [WIP][Improvment] improve resource service response May 15, 2024
@caishunfeng caishunfeng changed the title [WIP][Improvment] improve resource service response [Improvment] improve resource service response May 16, 2024
@caishunfeng caishunfeng self-assigned this May 16, 2024
@caishunfeng caishunfeng added the improvement make more easy to user or prompt friendly label May 16, 2024
*/
Result<Object> verifyResourceName(String fullName, ResourceType type, User loginUser);
void verifyResourceName(String fullName, ResourceType type, User loginUser);

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'loginUser' is never used.
void createDirectory(User loginUser,
String name,
ResourceType type,
int pid,

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'pid' is never used.
}
if (FileUtils.directoryTraversal(Objects.requireNonNull(file.getOriginalFilename()))) {
log.warn("File original name verify failed, fileOriginalName:{}.",
RegexUtils.escapeNRT(file.getOriginalFilename()));

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
if (!fileSuffix.equalsIgnoreCase(nameSuffix)) {
// rename file suffix and original suffix must be consistent
log.warn("Rename file suffix and original suffix must be consistent, fileOriginalName:{}.",
RegexUtils.escapeNRT(file.getOriginalFilename()));

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
Comment on lines +379 to +381
log.warn(
"Resource file size is larger than max file size, fileOriginalName:{}, fileSize:{}, maxFileSize:{}.",
RegexUtils.escapeNRT(file.getOriginalFilename()), file.getSize(), Constants.MAX_FILE_SIZE);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend improvement make more easy to user or prompt friendly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants