From c5319274ca4e8322c250d0b7a9ae9ac036ec4432 Mon Sep 17 00:00:00 2001 From: Nathan Musoke Date: Tue, 9 May 2017 15:38:50 +1200 Subject: [PATCH] IPFS plugin: Add note to check hashes carefully In the future, just checking that a hash begins with "Qm" and has length 46 will likely not be sufficient. --- beetsplug/ipfs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/beetsplug/ipfs.py b/beetsplug/ipfs.py index 88e305213..0e9b0c1f1 100644 --- a/beetsplug/ipfs.py +++ b/beetsplug/ipfs.py @@ -147,6 +147,8 @@ class IPFSPlugin(BeetsPlugin): def ipfs_get(self, lib, query): query = query[0] # Check if query is a hash + # TODO: generalize to other hashes; probably use a multihash + # implementation if query.startswith("Qm") and len(query) == 46: self.ipfs_get_from_hash(lib, query) else: