Fix double split-text issue causing incorrect filename truncation#1964
Fix double split-text issue causing incorrect filename truncation#1964santoshray02 wants to merge 1 commit into
Conversation
Resolved an issue where using split-text twice resulted in incorrect truncation of filenames containing multiple dots. For instance, a file named '2018_01_Items_1-2-2018-2191.30.jpg' was being improperly shortened to '2018_01_Items_1-2-2018-2191.jpg'.
gaotongxiao
left a comment
There was a problem hiding this comment.
Thanks for your contribution. The fix is still not quite elegant as it would never remove file extension, and the output filename would become something like "1.jpg.jpg".
A better way is to keep all the filename split except for the last one:
out_file = '.'.join(osp.splitext(img_name)[:-1])
|
Hi @santoshray02, We'd like to express our appreciation for your valuable contributions to the mmocr. Your efforts have significantly aided in enhancing the project's quality. If you're on WeChat, we'd also love for you to join our community there. Just add our assistant using the WeChat ID: openmmlabwx. When sending the friend request, remember to include the remark "mmsig + Github ID". Thanks again for your awesome contribution, and we're excited to have you as part of our community! |
Resolved an issue where using split-text twice resulted in incorrect truncation of filenames containing multiple dots. For instance, a file named '2018_01_Items_1-2-2018-2191.30.jpg' was being improperly shortened to '2018_01_Items_1-2-2018-2191.jpg'.
Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
Motivation
Please describe the motivation of this PR and the goal you want to achieve through this PR.
Modification
Please briefly describe what modification is made in this PR.
BC-breaking (Optional)
Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.
Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.
Checklist
Before PR:
After PR: