Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tootctl media lookup doesn't work for local media #33923

Open
brookmiles opened this issue Feb 14, 2025 · 0 comments
Open

tootctl media lookup doesn't work for local media #33923

brookmiles opened this issue Feb 14, 2025 · 0 comments
Labels
status/to triage This issue needs to be triaged

Comments

@brookmiles
Copy link

Steps to reproduce the problem

  1. run tootctl media lookup on the URL of a locally posted media file

Expected behaviour

Displays URL of post containing the given media file

Actual behaviour

Displays "Not a media URL"

Detailed description

Running the command:
RAILS_ENV=production bin/tootctl media lookup https://media.mastodon.sunny.garden/media_attachments/files/113/632/298/078/427/840/original/656aebb68bf18a19.jpg

Returns:
Not a media URL

And yet, it clearly is a media URL.

A brief inspection of the code at...

fail_with_message 'Not a media URL' unless VALID_PATH_SEGMENTS_SIZE.include?(path_segments.size)
... shows that the code relies on specific numbers of URL path elements, which do not match up with the actual number of elements in a local media path.

If I pass in a modified URL to add a "/cache" path element - which the code will strip out - the number of path elements now matches and the command will successfully look up the post, even though the actual URL passed in is invalid.

Running:
RAILS_ENV=production bin/tootctl media lookup https://media.mastodon.sunny.garden/cache/media_attachments/files/113/632/298/078/427/840/original/656aebb68bf18a19.jpg

Returns:
https://sunny.garden/@brook/113632322942825152

Mastodon instance

sunny.garden

Mastodon version

v4.3.3

Technical details

If this is happening on your own Mastodon server, please fill out those:

  • Ruby version: ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [x86_64-linux]
  • Node.js version: v20.17.0
@brookmiles brookmiles added the status/to triage This issue needs to be triaged label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/to triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant