auto-archiver icon indicating copy to clipboard operation
auto-archiver copied to clipboard

Google Drive bug with leading /

Open djhmateer opened this issue 3 years ago • 0 comments

In telethon if there are subdirectories wanting creating, sometimes a key is passed with a leading / character which confuses the join.

I've worked around it by adding a catch, but need to clean up

  • find the root cause
  • keep catch in logging to error log so we know if it happens again

https://github.com/bellingcat/auto-archiver/blob/main/storages/gd_storage.py

    def uploadf(self, file: str, key: str, **_kwargs):
        """
        1. for each sub-folder in the path check if exists or create
        2. upload file to root_id/other_paths.../filename
        """
        # doesn't work if key starts with / which can happen from telethon todo fix
        if key.startswith('/'):
            # remove first character ie /
            key = key[1:]

A example is: https://t.me/witnessdaily/169265

djhmateer avatar Jul 07 '22 11:07 djhmateer