make file2key reject E* backend keys with a long extension
authorJoey Hess <joeyh@joeyh.name>
Fri, 24 Feb 2017 15:17:07 +0000 (11:17 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 24 Feb 2017 15:22:15 +0000 (11:22 -0400)
commit35739a74c211d24f472948f1b1bbae3368b3c292
tree3f78427be36f337a7c4438ca61a7f787c3ac84b2
parent63df8d8966571e228c0e0d7d3c29467186970fd3
make file2key reject E* backend keys with a long extension

I am not happy that I had to put backend-specific code in file2key. But
it would be very difficult to avoid this layering violation.

Most of the time, when parsing a Key from a symlink target, git-annex
never looks up its Backend at all, so adding this check to a method of
the Backend object would not work.

The Key could be made to contain the appropriate
Backend, but since Backend is parameterized on an "a" that is fixed to
the Annex monad later, that would need Key to change to "Key a".

The only way to clean this up that I can see would be to have the Key
contain a LowlevelBackend, and put the validation in LowlevelBackend.
Perhaps later, but that would be an extensive change, so let's not do
it in this commit which may want to cherry-pick to backports.

This commit was sponsored by Ethan Aubin.
CHANGELOG
Types/Key.hs
doc/todo/sha1_collision_embedding_in_git-annex_keys.mdwn