fix lint errors (line length, unused var, nested if)

This commit is contained in:
Username
2025-12-20 18:31:47 +01:00
parent 9e92db5217
commit d0b199de11
2 changed files with 7 additions and 9 deletions

View File

@@ -40,9 +40,10 @@ class Config:
MIN_ENTROPY_SIZE = int(os.environ.get("FLASKPASTE_MIN_ENTROPY_SIZE", 256)) MIN_ENTROPY_SIZE = int(os.environ.get("FLASKPASTE_MIN_ENTROPY_SIZE", 256))
# Require binary content (reject recognizable formats) # Require binary content (reject recognizable formats)
# When enabled, rejects content with known magic bytes (PNG, JPEG, PDF, etc.) # Rejects content with known magic bytes (PNG, JPEG, PDF, etc.) and UTF-8 text.
# and valid UTF-8 text. Only application/octet-stream allowed. REQUIRE_BINARY = (
REQUIRE_BINARY = os.environ.get("FLASKPASTE_REQUIRE_BINARY", "0").lower() in ("1", "true", "yes") os.environ.get("FLASKPASTE_REQUIRE_BINARY", "0").lower() in ("1", "true", "yes")
)
# Reverse proxy trust configuration # Reverse proxy trust configuration
# SECURITY: The X-SSL-Client-SHA1 header is trusted for authentication. # SECURITY: The X-SSL-Client-SHA1 header is trusted for authentication.

9
fpaste
View File

@@ -722,7 +722,6 @@ def main():
# Pre-process arguments: if first positional looks like a file, insert "create" # Pre-process arguments: if first positional looks like a file, insert "create"
args_to_parse = sys.argv[1:] args_to_parse = sys.argv[1:]
commands = {"create", "c", "new", "get", "g", "delete", "d", "rm", "info", "i", "cert", "pki"} commands = {"create", "c", "new", "get", "g", "delete", "d", "rm", "info", "i", "cert", "pki"}
top_level_opts = {"-s", "--server", "-h", "--help"}
# Find insertion point for "create" command # Find insertion point for "create" command
insert_pos = 0 insert_pos = 0
@@ -753,11 +752,9 @@ def main():
break break
i += 1 i += 1
# Insert "create" if no command found and we have input # Insert "create" if no command found and we have input (file path or piped stdin)
# (either a file path or piped stdin) if not has_command and (file_pos >= 0 or not sys.stdin.isatty()):
if not has_command: args_to_parse.insert(insert_pos, "create")
if file_pos >= 0 or not sys.stdin.isatty():
args_to_parse.insert(insert_pos, "create")
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
prog="fpaste", prog="fpaste",