Encode database label file names using URL encoding (optionally)
Often database label (the name of a graph) needs to be a URI. However, this conflicts with the file system when directory store is used. The proposed solution is to encode the label file name using URL encoding, it is also backwards compatible.
I don't think this is actually backwards compatible though, as various label names that are possible now would be transformed by this change. In particular, any label with a % in it would stop working, as url-encoding them will turn that into %25. The same goes for the pipe character (|) which turns into %7C.
Both are pretty relevant for us because in TerminusDB we actually use url encoding and pipes (as separator between organization and data product) for our label names. So we currently have a whole bunch of label files with % and | characters in them that would stop working with this change.
I wonder if there's not some other strategy we could take here. For example, you could define another label store which acts as a name-transforming proxy. Or we could provide an option in the constructor. Or maybe a feature flag. But as-is, I don't think this is a good idea.
Fair enough. I will look into making this more configurable. Would be of course nice to get both backwards compatibility and proper handling of names with other special characters, but maybe it's too late now.
@matko Please, have a look at the modified solution. I made label file name encoding pluggable and provided two default implementations - identity and URL encoder. Do you think this may be something worth merging?