When an app does not have a logo set, or the URL does not point to an image, apps will create a random placeholder file, which fills up our file_managed table and adds an entry inside our files folder which will add files everything the apps module is called. This should not create a file in the first place when the logo is not valid.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

iSoLate’s picture

iSoLate’s picture

Assigned: iSoLate » Unassigned
Status: Active » Needs review
pfrenssen’s picture

Patch does not apply to the latest dev release.

+++ b/apps.manifest.inc
@@ -237,51 +237,56 @@ function apps_retrieve_app_image($url, $title = FALSE, $alt = FALSE) {
+  // When there are no more then 2 entries inside the array for the different
+  // url parts then there is no physical file and we will receive a
+  // "placeholder" which will fill up our file_managed table and our files
+  // directory.
+  if (sizeof($url_parts) > 2) {

This will not work in all circumstances. The location of the files folder is configurable, so you cannot rely on it being in /sites/default/files.

This also does not cover the actual problem, this only fixes the problem when the url cannot actually be parsed by parse_url. The problem still occurs if a valid URL is passed which does not point to an image (eg http://www.google.com/).

pfrenssen’s picture

Title: When an app does not have a logo set, apps will create a random placeholder file. » When an app tries to download an invalid logo a random placeholder file is created

Wow. Wrong field :-/

pfrenssen’s picture

Version: 7.x-1.0-beta7 » 7.x-1.x-dev
Category: task » bug
FileSize
605 bytes

Here is a better solution. Check if the downloaded file is an actual image before saving it.

pfrenssen’s picture

The above patch only works with the GD library. This patch is better, it uses the image API so it will work with whatever image toolkit has been installed: GD, imagemagick etc.

pfrenssen’s picture

#1665048: Broken images links being downloaded has been marked as a duplicate of this issue.

pfrenssen’s picture

Issue summary: View changes

Updated description.

iSoLate’s picture

Issue summary: View changes
Status: Needs review » Closed (fixed)

This seems to be already in in the latest 7.x-1.x branch?