AI Update: اقدامات پیشنهادی رو انجام بده
This commit is contained in:
@@ -52,6 +52,10 @@ DEFAULT_FTP_EXCLUDES = [
|
||||
"env",
|
||||
"env/*",
|
||||
|
||||
# Dependencies & local packages
|
||||
"node_modules",
|
||||
"node_modules/*",
|
||||
|
||||
# Logs & temp files
|
||||
"*.log",
|
||||
"tmp",
|
||||
@@ -77,20 +81,23 @@ def should_exclude(rel_path: str, custom_excludes: Optional[List[str]] = None) -
|
||||
"""Checks if a relative path matches any exclusion pattern."""
|
||||
excludes = DEFAULT_FTP_EXCLUDES + (custom_excludes or [])
|
||||
norm_path = rel_path.replace("\\", "/").strip("/")
|
||||
parts = norm_path.split("/")
|
||||
parts = [p for p in norm_path.split("/") if p]
|
||||
|
||||
for pattern in excludes:
|
||||
pat = pattern.replace("\\", "/").strip("/")
|
||||
clean_pat = pat.rstrip("/*")
|
||||
|
||||
# Check against full relative path
|
||||
if fnmatch.fnmatch(norm_path, pat):
|
||||
if fnmatch.fnmatch(norm_path, pat) or fnmatch.fnmatch(norm_path, clean_pat):
|
||||
return True
|
||||
|
||||
# If path starts with directory pattern
|
||||
if norm_path == clean_pat or norm_path.startswith(clean_pat + "/"):
|
||||
return True
|
||||
|
||||
# Check against individual directory / file parts
|
||||
for part in parts:
|
||||
if fnmatch.fnmatch(part, pat):
|
||||
return True
|
||||
# If pattern is a directory (e.g. .git/* or .git), match if path starts with it
|
||||
clean_pat = pat.rstrip("/*")
|
||||
if norm_path == clean_pat or norm_path.startswith(clean_pat + "/"):
|
||||
if fnmatch.fnmatch(part, pat) or fnmatch.fnmatch(part, clean_pat):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import html
|
||||
import logging
|
||||
import asyncio
|
||||
import urllib.request
|
||||
@@ -12,6 +13,11 @@ from config import settings
|
||||
|
||||
logger = logging.getLogger("AGYGitManager")
|
||||
|
||||
def escape_html(text: str) -> str:
|
||||
if not text:
|
||||
return ""
|
||||
return html.escape(str(text), quote=False)
|
||||
|
||||
DEFAULT_GITIGNORE = """# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user