Skip to content

fix: narrow exception in Content-Length header lookup from Exception to AttributeError - #3918

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/content-length-narrow-exception
Open

Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/content-length-narrow-exception

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Problem

Bare except Exception would swallow MemoryError, RecursionError, etc.

Fix

Narrow to AttributeError which is the only realistic failure from getheader().

Testing

  • Verified Content-Length header is read correctly

  • Verified missing header is handled gracefully

…to AttributeError

Bare 'except Exception' would swallow MemoryError, RecursionError,
etc. The only realistic failure from getheader() is AttributeError.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Narrows Content-Length lookup error handling to avoid swallowing critical exceptions.

Changes:

  • Catches only AttributeError from getheader().
Show a summary per file
File Description
src/specify_cli/workflows/_commands.py Narrows header lookup exception handling.

Review details

Tip

Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced

try:
raw_length = getheader("Content-Length")
except Exception:
except AttributeError:

@mnriem mnriem left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address Copilot feedback

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants