cryptomator / cryptofs

Java Filesystem Provider with integrated encryption
GNU Affero General Public License v3.0
93 stars 35 forks source link

Health API: Fix for MissingContentDir wrong #152

Closed infeo closed 1 year ago

infeo commented 1 year ago

Per spec, the content directory in cipher space consists of 32 characters representing the SHA1 hash of the directory id. (for an example, see spec)

The result MissingContentDir indicates, that for an existing dirId, the content dir is missing. The fix is to create the directory. But looking at the code to fix it, it is wrongly implemented: https://github.com/cryptomator/cryptofs/blob/2f42f3c8bc60423b70e7c7f5a9f654eb4f85a943/src/main/java/org/cryptomator/cryptofs/health/dirid/MissingContentDir.java#L52

Java substring method takes two indices, not a start index and a length.