Skip to content

Commit

Permalink
Removed foo.bar.
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarons committed Mar 16, 2023
1 parent 463a3d8 commit 6eab828
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ repos:
- --configfile=tests/bandit.yaml
files: ^(src|tests)/.+\.py$
- repo: https://github.com/PyCQA/isort
rev: 5.11.4
rev: 5.12.0
hooks:
- id: isort
args:
Expand Down
8 changes: 5 additions & 3 deletions src/sync_drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import os
import re
import time
from pathspec import PathSpec
from pathlib import Path
from shutil import copyfileobj, rmtree, unpack_archive

import magic
from icloudpy import exceptions
from pathspec import PathSpec

from src import LOGGER, config_parser

Expand All @@ -35,7 +35,7 @@ def wanted_file(filters, ignore, file_path):
def wanted_folder(filters, ignore, root, folder_path):
"""Check if folder is wanted."""
if ignore:
if PathSpec.from_lines("gitwildmatch", ignore).match_file(f"{folder_path}/foo.bar"):
if PathSpec.from_lines("gitwildmatch", ignore).match_file(f"{folder_path}/"):
return False
if not filters or not folder_path or not root or len(filters) == 0:
# Nothing to filter, return True
Expand Down Expand Up @@ -78,7 +78,9 @@ def process_folder(item, destination_path, filters, ignore, root):
if not (item and destination_path and root):
return None
new_directory = os.path.join(destination_path, item.name)
if not wanted_folder(filters=filters, ignore=ignore, folder_path=new_directory, root=root):
if not wanted_folder(
filters=filters, ignore=ignore, folder_path=new_directory, root=root
):
LOGGER.debug(f"Skipping the unwanted folder {new_directory} ...")
return None
os.makedirs(new_directory, exist_ok=True)
Expand Down

0 comments on commit 6eab828

Please sign in to comment.