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

Materials/index.html can not render a file of which Path has length longer than 255 characters #28

Open
kazurayam opened this issue Jun 30, 2020 · 7 comments

Comments

@kazurayam
Copy link
Owner

kazurayam commented Jun 30, 2020

In my application,
MaterialRepository#resolveScreenshotPathByURLPathCompoents(String, String,URL, int, String) produced a screenshot file of which Path has length longer than 255 characters which is the limit of Windows File System. For example I have

  • Materials/HP.base.chronos.chronos_capture/HP_byサービス名_本番環境_category1 - SMBC/20200630_100308/HP.processHpAUTConfig/SMBC/smbc_nikko%2Fqsearch.exe%3FF%3Dusers%2Fsmbc-nikko%2Fkensaku%26KEY1%3D%26KEY2%3D%26KEY3%3D%26KEY4%3D%26GO_BEFORE%3D%26BEFORE%3D.png

Browsers can not render those too-long path files appropriately. Long Paths causes annoying problems.

tooLongPathBasedOnURL

Materials should silently generate Path less than the limit silently in order to avoid miscellenious problems.

@kazurayam kazurayam changed the title Materials/index.html can not render a file of which Path has length longer than 260 characters Materials/index.html can not render a file of which Path has length longer than 255 characters Jun 30, 2020
@kazurayam
Copy link
Owner Author

@kazurayam
Copy link
Owner Author

The following orignal path string has 257 characters.

Materials/HP.base.chronos.chronos_capture/HP_byサービス名_本番環境_category1 - SMBC日興証券/20200630_100308/HP.processHpAUTConfig/SMBC日興証券/smbc_nikko%2Fqsearch.exe%3FF%3Dusers%2Fsmbc-nikko%2Fkensaku%26KEY1%3D%26KEY2%3D%26KEY3%3D%26KEY4%3D%26GO_BEFORE%3D%26BEFORE%3D.png

I want to make it more compact.

Let me try removing all '%aa' escaped sequences.

I got a string:

Materials/HP.base.chronos.chronos_capture/HP_byサービス名_本番環境_category1 - SMBC日興証券/20200630_100308/HP.processHpAUTConfig/SMBC日興証券/smbc_nikkoqsearch.exeFuserssmbc-nikkokensakuKEY1KEY2KEY3KEY4GO_BEFOREBEFORE.png

This string has only 206 characters length. This is far less than the limit of 255.
And this string preserves information to identify the file from others.

@kazurayam
Copy link
Owner Author

kazurayam commented Jun 30, 2020

OK, then. I will implment this compaction rule.

  1. file name will be compacted. parent directories will be left unchanged.
  2. if the length of Absolute path exceed the 255, then the compaction rule will be applied.
  3. In the file name, character strings of '%nn' will be removed.
  4. if the length of Absolute path still exceeds the 255, then the file name will be chomped to form a path name less than 255.
  5. if the URL contains many queries, then filtering '&' and '=" will shorten the path. But it may not be enough; not guaranteed at all.

@kazurayam
Copy link
Owner Author

kazurayam commented Jun 30, 2020

I made a tentative solution to this problem.

The real fix will require a complete redesigning as #29.

@kazurayam kazurayam reopened this Aug 11, 2020
@kazurayam
Copy link
Owner Author

30th Jun I made a cosmetical chage:

if the URL contains many queries, then filtering '&' and '=" will shorten the path. But it may not be enough; not guaranteed at all.

This change was meaningless. Windows' LogPathsEnabled is enough.

So I should bring this change back.

@kazurayam
Copy link
Owner Author

done

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

No branches or pull requests

1 participant