Skip to content

slack-gif-creator: validate_gif and is_slack_ready ignore file size limits, 7MB emoji marked “Slack Ready” #116

@tmustier

Description

@tmustier

Summary

When validating large GIFs, validate_gif and is_slack_ready currently only enforce dimension limits. Files >5MB are noted in the output, but this does not affect the final passes result, and is much above the Slack guidance of max 128kb.

I suggest either

  • Pass with warning at >128kb
  • Fail at >128kb

Happy to send a tiny PR if that's helpful!


Reproduction

Steps to reproduce

  1. Create a 128x128 animated GIF with many frames so the file is several MB.
    (in my case: 400 frames @ 50 fps, 128x128, size ~6.95 MB)
  2. Run:
    from core.validators import validate_gif, is_slack_ready
    
    passes, info = validate_gif("hello_shake_huge.gif", is_emoji=True, verbose=True)
    print("passes:", passes)
    print("slack_ready:", is_slack_ready("hello_shake_huge.gif", is_emoji=True))

Observed

Console output (abridged):

Validating hello_shake_huge.gif:
  Dimensions: 128x128 (optimal)
  Size: 7120.4 KB (6.95 MB)
  Frames: 400 @ 50.0 fps (8.0s)
  Note: Large file size - consider fewer frames/colors
   Validation Result: ✅ PASSES

...
Slack Ready: Yes - Ready to upload!

So validate_gif returns passes = True, and is_slack_ready also returns
True, even though the file is ~7MB.

Expected

Either

  • Warn at lower threshold
  • Large files should fail validation

Suggestion: 128kb per Slack's docs.
Note: Slack says 'If your image is too large, we’ll try to resize it for you.', but even a 1.3MB version I created failed to upload.


Diagnosis and recommendation

Likely cause

Looking at core/validators.py:

  • validate_gif calculates dim_pass from validate_dimensions.
  • File size is checked only to print a “Note: Large file size…” message.
  • The final passes value only uses the dimension result, not size.
  • is_slack_ready simply wraps validate_gif and returns passes.

So file size never participates in the boolean success/fail, even when
is_emoji=True.

Possible fix

  1. Simpler: update the warnings
  • Warn at >128kb with descriptive message, for example:

Warning: File size >128kb Slack guideline - consider fewer frames/colors

  1. Stricter: have validate_gif combine both dimension and size checks into passes.
  • For example (pseudocode):
    dim_pass, dim_info = validate_dimensions(width, height, is_emoji=is_emoji)
    size_pass, size_info = check_slack_size(path, is_emoji=is_emoji)
    
    passes = dim_pass and size_pass
    info = {"dimensions": dim_info, "size": size_info}
    
    and have is_slack_ready(path, is_emoji=True) return that combined passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions