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

fixed the cleanup renaming which will only rename ".pdf" files. #12396

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

laky241
Copy link

@laky241 laky241 commented Jan 18, 2025

Fixes #11358

added a new method allowedFileType which allow clean up to rename only ".pdf files"

other files like "jpeg" or "XYZ" will be skipped for renaming.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

@Siedlerchr
Copy link
Member

Please have a look at the unit tests, guess due to limiting it to pdf now tests fail and need to be adapted by adding the extension

@laky241
Copy link
Author

laky241 commented Jan 19, 2025

@Siedlerchr made the changes, how it is looking.

private boolean allowedFileType(String filePath) {
String lowerCase = filePath.toLowerCase();

return lowerCase.endsWith(".pdf");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use

public static boolean isPDFFile(Path file) {

@laky241 laky241 requested a review from InAnYan January 21, 2025 17:22
@jiucenglou
Copy link

Please have a look at the the original issue which asks for more options than just renaming pdf files. For example, I asked if "-fig6" and the "-fig8" postfixes can be retained after renaming. :)

ideal behavior
old-ms-key.pdf			->	new-ms-key.pdf
old-ms-key-si.pdf		->	new-ms-key-si.pdf
old-ms-key-fig5.jpg		->	new-ms-fig5.jpg
old-ms-key-fig8.xyz		->	new-ms-fig8.xyz

Currently, the postfixes are not respected and the files are categorized by extensions and ordered in their categories.

@laky241
Copy link
Author

laky241 commented Jan 22, 2025

@jiucenglou is changes looking good or need some more work ?

LOGGER.info("Skipping renaming: {}", file.getLink());

String fullName = Path.of(file.getLink()).getFileName().toString();
int dot = fullName.lastIndexOf('.');
Copy link
Member

Choose a reason for hiding this comment

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

Check out FileUtli. there is stuff like getFileExtension
and getBaseName

@jiucenglou
Copy link

@jiucenglou is changes looking good or need some more work ?

Thanks ! However it is probably necessary to use regex matching instead of looking for "-" right ?

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

@laky241
Copy link
Author

laky241 commented Jan 23, 2025

Hi @Siedlerchr,
I noticed that the tests are failing due to the use of a deprecated version of actions/upload-artifact: v3 in the GitHub Actions workflow, have i made any mistake in my changes

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.

More option for "clean up" "renaming".
4 participants