I have a new site and a local and an s3 container bundled in a class. if i upload a file to that class the file gets shown by a preview link with that url
system/storage/serve/13/dsc_1091.jpg
The problem is that this url in the node edit screen is not found 404. I have to wait until the cron copies the file to s3 then the url points to s3 which is the final storage place. The s3 url works normal. I would be happy for a tip what this behaviror could be causing.

Comments

fox_01 created an issue. See original summary.

fox_01’s picture

Issue summary: View changes
Perignon’s picture

What content type is the file attached to?

Does your PHP support file streams?

fox_01’s picture

I dont know which setting sou mean exactly but i found that in php info

Registered PHP Streams ftps, compress.zlib, compress.bzip2, php, file, glob, data, ftp, zip, phar, http, https, feed, storage-field-image, storage-field-close-image, storage-field-face-picture, storage-field-background, storage-field-imagen-slide, storage-field-attached-files, storage-field-company-registration-copy, storage-field-passport-copy, storage-file-default-scheme, storage-api, public, temporary, private

Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, tls

Registered Stream Filters zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk

Perignon’s picture

Are these images styled images?

Perignon’s picture

inquis’s picture

Version: 7.x-1.6 » 7.x-1.8

I have the same issue.
Until I run cron, on the node edit page the url to styled image's preview is like /system/storage/serve/50/1381_2.jpg?itok=JD3w0ki7, which returns 404.
Looking storage_menu() hook, all we have is system/storage/serve/%storage_menu route, so it knows nothing about filename /1381_2.jpg.

It seems like the problem is in the function path() of storage_api/storage.inc on the line 431:

public function path() {
  return 'system/storage/serve/' . $this->storage_id . ($this->filename ? ('/' . drupal_basename($this->filename)) : '');
}

Changing to the following seems to work for me:

public function path() {
  return 'system/storage/serve/' . $this->storage_id;
}
Perignon’s picture

Without the storage ID, you will not be able to build multiple containers.

inquis’s picture

It seems like the file name makes a problem, not the storage ID.

Before:
/system/storage/serve/50/1381_2.jpg
after:
/system/storage/serve/50

In this example, storage_id is 50 and file name is 1381_2.jpg