-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix broken default logo image #3657
Fix broken default logo image #3657
Conversation
If you go to the sysadmin config page, and if you don't change the logo image and just click Update, the logo image will break. The reason is because its been given wrong path to the image.
Ready for review. |
ckan/logic/action/update.py
Outdated
for f in os.listdir(ckan_images_path): | ||
if f == value: | ||
image_in_ckan = True | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os.isfile can be used instead of a for loop here
@wardi Now it should be good. |
@wardi Can you check this again? :) |
I think the underlying problem is that the admin form is receiving the correct value ( <input id="field-image-url" type="url" name="ckan.site_logo" value="/base/images/ckan-logo.png" placeholder="http://example.com/my-image.jpg" class="form-control" readonly=""> But sending the wrong value to the controllers, it will only send the file name ( |
That still won't resolve the issue because the controller doesn't know whether the default image is uploaded from a user or available already from CKAN's local images directory. |
True, but then it's just a matter of covering the local image case in the if key =='ckan.site_logo' and value and not (value.startswith('http') or value.startswith('/')): |
Uploaded images from user and CKAN's images from local folder will pass the condition. |
Sorry, I meant: if key =='ckan.site_logo' and value and not value.startswith('http') and not value.startswith('/'): |
@amercader Can you check now? |
Fixes #3656
Features: