Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Bug in icon for enclosures #8275

Closed
Toflar opened this issue Mar 15, 2016 · 7 comments
Closed

Bug in icon for enclosures #8275

Toflar opened this issue Mar 15, 2016 · 7 comments
Assignees
Labels
Milestone

Comments

@Toflar
Copy link
Member

Toflar commented Mar 15, 2016

The function Controller::addEnclosuresToTemplate() does not consider own icons for assets.

The code does a hardcoded

'icon'      => TL_ASSETS_URL . 'assets/contao/images/' . $objFile->icon,

which renders the support for $GLOBALS['TL_MIME'] useless. Because when I do something like this

$GLOBALS['TL_MIME']['pdf'][1] = 'files/css/images/mime-pdf.png';

it will result in assets/contao/images/files/css/images/mime-pdf.png.
I consider this a bug because everywhere else where we use the icon of a file, we use Image::getHtml() which considers own paths like this:

if (strpos($src, '/') === false)
{
    if (strncmp($src, 'icon', 4) === 0)
    {
         $static = TL_ASSETS_URL;
         $src = 'assets/contao/images/' . $src;
    }
    // etc.
@leofeyer leofeyer added this to the 3.5.9 milestone Mar 15, 2016
@Toflar
Copy link
Member Author

Toflar commented Mar 15, 2016

Same applies for ContentMedia by the way:

$return .= '<li><img src="' . TL_ASSETS_URL . 'assets/contao/images/' . $objFile->icon . '" width="18" height="18" alt="" class="mime_icon"> <span>' . $objFile->name . '</span> <span class="size">(' . $this->getReadableSize($objFile->size) . ')</span></li>';

@leofeyer
Copy link
Member

Hm, turns out this is not really a bug – rather a case which we have forgotten to think of. By default, there are not paths in $GLOBALS['TL_MIME'], which of course does not mean that there should never be any. But supporting paths requires quite a few changes and is a new feature IMHO, isn't it?

@contao/developers /cc

@Toflar
Copy link
Member Author

Toflar commented Mar 16, 2016 via email

@discordier
Copy link
Contributor

I am tempted to be with @Toflar on this one.
In fact, it is a new feature as pointed out by @leofeyer but (and a big but here) it is a feature which corrects an initial misconception in a feature that is rendering the original feature pretty useless and therefore IMO qualifies as bug.

@leofeyer
Copy link
Member

and a big but here

I don't think that this is an english phrase 😄

@leofeyer
Copy link
Member

Fixed in a76e791

@discordier
Copy link
Contributor

I don't think that this is an english phrase 😄

Yeah, you are right. I simply lacked a better phrase. 😀

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Mar 26, 2016
### 4.1.2 (2016-03-22)

 * Handle derived classes in the exception converter (see #462).
 * Prevent the autofocus attribute from being added multiple times (see contao/core#8281).
 * Respect the SSL settings of the root page when generating sitemaps (see contao/core#8270).
 * Read from the temporary file if it has not been closed yet (see contao/core#8269).
 * Always use HTTPS if the target server supports SSL connections (see contao/core#8183).
 * Adjust the meta wizard field length to the column length (see contao/core#8277).
 * Correctly handle custom mime icon paths (see contao/core#8275).
 * Show the 404 error page if an unpublished article is requested (see contao/core#8264).
 * Correctly count the URLs when rebuilding the search index (see contao/core#8262).
 * Ensure that every image has a width and height attribute (see contao/core#8162).
 * Set the correct mime type when embedding SVG images (see contao/core#8245).
 * Handle the "float_left" and "float_right" classes in the back end (see contao/core#8239).
 * Consider the fallback language if a page alias is ambiguous (see contao/core#8142).
 * Fix the error 403/404 redirect (see contao/website#74).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants