pdfcpu icon indicating copy to clipboard operation
pdfcpu copied to clipboard

fix issue on alphanumeric sorting on filenames

Open mrtrkmn opened this issue 4 years ago • 3 comments

Signed-off-by: mrtrkmn [email protected]

When I use the pdfcpu tool I have realized an issue regarding to sorting files when we want to merge.

The problem occurs when we have filenames which are like

  • a-2-b
  • a-32-b
  • a-12-a
  • a-4-b

Small example to the problem can be found here:

https://play.golang.com/p/3FuTcjOpU3j

Expected result: [a-2-b a-4-b a-12-a a-32-b]

Actual result: [a-12-a a-2-b a-32-b a-4-b]

mrtrkmn avatar Feb 11 '22 22:02 mrtrkmn

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Feb 11 '22 22:02 CLAassistant

There is a bug that on this feature request, therefore, converted into draft.

mrtrkmn avatar Feb 12 '22 11:02 mrtrkmn

Hi there and sorry for the delay!

Your suggested file sorting extension prior to merging maskes sense unfortunately this is not something I can accept right away and here is why:

This is a CLI extension and we need to be careful to remain backwards compatible. There is aleady a sort flag on the merge command and this needs to be extended. Rest assured I will consider this and include it in the next release.

Thank you for your contribution 💚

hhrutter avatar Mar 27 '22 18:03 hhrutter

For backwards compatibility reasons I have decided the sort option on the CLI remains as is. Any sophisticated sorting can easily be injected when using the API.

hhrutter avatar Apr 08 '23 15:04 hhrutter