zip4j icon indicating copy to clipboard operation
zip4j copied to clipboard

Renaming a file can rename also another similar file

Open optyfr opened this issue 3 months ago • 0 comments

suppose I have 2 entries :

  • abcd.tmp
  • abcd.tmp0

If I rename abcd.tmp to bcde.tmp, then abcd.tmp0 is also renamed to bcde.tmp0 !!!

This is probably related to this line : https://github.com/srikanth-lingala/zip4j/blob/c4c993cb143db99832eadd03699bd8228a9793b8/src/main/java/net/lingala/zip4j/tasks/RenameFilesTask.java#L128

Every file headers that starts with the file to rename are matching, and so they get renamed by overwritting with the new name up to the len of the new name

Replacing startsWith method with equals should solve the problem

optyfr avatar Mar 31 '24 20:03 optyfr