doczjs / docz

✍ It has never been so easy to document your things!
https://docz.site
MIT License
23.61k stars 1.46k forks source link

Very long path names cause ENAMETOOLONG errors #1649

Open sebakerckhof opened 3 years ago

sebakerckhof commented 3 years ago

Bug Report

Most file systems / OSs restrict the length of file names, generally to to 255 bytes. Docz writes files to the cache with a concatenated path as file name, but this crashes when the file name gets too long, resulting in an error like:

ENAMETOOLONG: name too long, open '/home/seba/dev/ebo/raf-core-react/.docz/.cache/json/_src-library-components-containers-master-detail-overview-overview-cards-overview-card-overview-card-action-button-overview-card-action-button.json'

Expected behavior

A good way to handle this is to fixed-size hash the file name portions that exceed the max length. This is how Gatsby handles this, see: https://github.com/gatsbyjs/gatsby/issues/20699 / https://github.com/gatsbyjs/gatsby/pull/21518

Environment