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

apps/bplan: Replace imghdr with python-magic #5951

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

partizipation
Copy link

imghdr support was deprecated in python, so this uses python-magic and built-in mime to check the filetype of images files for bplans created using the API.

Also reorders some conditionals to fix a bug where bug tile_image was being used instead of image_url.

Test with curl like so:

curl  -X POST http://127.0.0.1:8003/api/organisations/1/bplan/ \
 --user '[email protected]':'password' \
 -H "Content-Type: application/json" \
 -d \
 '
 {
   "name":"Luisenblock Ost - Bebauungsplan 1-70",
   "bplan_id": "VI - 96a",
   "description": "Test",
   "url": "https://mein.berlin.de",
   "office_worker_email": "[email protected]",
   "start_date": "2019-01-01T00:00",
   "end_date": "2022-01-01T00:00",
   "image_url": "https://cdn.britannica.com/39/226539-050-D21D7721/Portrait-of-a-cat-with-whiskers-visible.jpg"
 }
'

The new bplan should be at http://127.0.0.1:8003/dashboard/organisations/liqd/bplans/

Tasks

  • PR name contains story or task reference
  • Steps to recreate and test the changes
  • Documentation (docs and inline)
  • Tests (including n+1 and django_assert_num_queries where applicable)
  • Changelog

also fixes bug tile_image used instead of image_url
@partizipation partizipation requested a review from goapunk January 16, 2025 16:55
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.

1 participant