1. 07 Dec, 2021 2 commits
  2. 06 Dec, 2021 3 commits
    • anarcat's avatar
      clarify a bit of obtuse logic · 0208ebba
      anarcat authored
      I was getting weird output from the script when trying to diagnose a
      blocked dangerbot (e.g. #17 or #18). I couldn't figure out what was
      going on and went to look at the code, then ended up staring at this
      line for 2 minutes:
      
              # non-empty folder or regular file
              if len(listing) > 1 or not path.endswith("/"):
      
      It stuck with me. I couldn't actually remember (let alone figure out)
      what that was supposed to do. I was so confused I actually ended up
      re-proving De Morgan's Laws:
      
      https://en.wikipedia.org/wiki/De_Morgan%27s_laws
      
      The gist of the change is that we change this:
      
              logging.info("sanitizing %s %s", folder, path)
              # non-empty folder or regular file
              if len(listing) > 1 or not path.endswith("/"):
                  # [...] do everything
      
      To this:
      
             if path.endswith("/") and len(listing) <= 1:
                  logging.info("skipping empty folder: %s/%s", folder, path)
                  return
             logging.info("sanitizing %s %s", folder, path)
             # [...] do everything
      
      The diff looks huge because we reindent the entire "# [...] do
      everything" block, but it's otherwise basically a noop, except we have
      a better error message.
      
      The output before:
      
      anarcat@curie:dangerzone-webdav-processor(main)$ ./dangerzone-webdav-processor -l https://nc.torproject.net/remote.php/dav/files/dangerzone-bot/ -u dangerzone-bot -n  -v
      authenticated with webdav https://nc.torproject.net/remote.php/dav/files/dangerzone-bot/
      sanitizing CVs (4)/ Candidate 33/
      sanitizing CVs (4)/ Candidate 35/
      
      after:
      
      anarcat@curie:dangerzone-webdav-processor(main)$ ./dangerzone-webdav-processor -l https://nc.torproject.net/remote.php/dav/files/dangerzone-bot/ -u dangerzone-bot -n  -v
      authenticated with webdav https://nc.torproject.net/remote.php/dav/files/dangerzone-bot/
      skipping empty folder: CVs (4)//Candidate 33/
      skipping empty folder: CVs (4)//Candidate 35/
      0208ebba
    • anarcat's avatar
      enforce black in CI · c1d0247a
      anarcat authored
      We do it in a rather convoluted way (ie. tox) but it will allow us to
      hook more goodies later, e.g. mypy, unit tests, etc.
      c1d0247a
    • anarcat's avatar
      blacken · 9e7a6887
      anarcat authored
      9e7a6887
  3. 27 Jul, 2021 2 commits
  4. 15 Jun, 2021 4 commits
  5. 14 Jun, 2021 3 commits
  6. 10 Jun, 2021 17 commits
  7. 09 Jun, 2021 6 commits
  8. 03 Jun, 2021 3 commits