From bf1fdcab096e65c244a01dddde05921ffd6dce4a Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 17 Aug 2025 15:19:25 +0000 Subject: [PATCH] fix #556 fuckup, fixes #624 --- copyparty/__main__.py | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 8bf042a4..5ee46622 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -441,15 +441,8 @@ def expand_cfg(argv) -> list[str]: supp = args_from_cfg(CFG_DEF[0]) argv = supp + argv - n = spins = 0 + n = 0 while n < len(argv): - if not n: - if spins % 1000 == 999: - t = "still expanding config files... giving up after %d more" - print(t % (9999 - spins)) - if spins > 9999: - t = "got stuck expanding config files; do you have a config-file which imports itself? this is where I gave up:\n%r" - raise Exception(t % (argv[:1000])) v1 = argv[n] v1v = v1[2:].lstrip("=") try: @@ -457,16 +450,12 @@ def expand_cfg(argv) -> list[str]: except: v2 = "" + n += 1 if v1 == "-c" and v2 and os.path.isfile(v2): - argv = argv[:n] + args_from_cfg(v2) + argv[n + 2 :] - spins += 1 - n = 0 - elif v1.startswith("-c") and v1v and os.path.isfile(v1v): - argv = argv[:n] + args_from_cfg(v1v) + argv[n + 1 :] - spins += 1 - n = 0 - else: n += 1 + argv = argv[:n] + args_from_cfg(v2) + argv[n:] + elif v1.startswith("-c") and v1v and os.path.isfile(v1v): + argv = argv[:n] + args_from_cfg(v1v) + argv[n:] return argv