Project

General

Profile

Actions

Bug #21884

open

Academica theme logo tools choke on S3

Added by Boone Gorges 25 days ago.

Status:
New
Priority name:
Normal
Assignee:
Category name:
S3 Uploads
Target version:
Start date:
2025-01-27
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

This kind of error occasionally appears in the logs:

[27-Jan-2025 20:05:49 UTC] PHP Warning:  Error executing "GetObject" on "https://s3.amazonaws.com/files.commons.gc.cuny.edu/wp-content/blogs.dir/3079/files/"; AWS HTTP error: Client error: `GET https://s3.amazonaws.com/files.commons.gc.cuny.edu/wp-content/blogs.dir/3079/files/` resulted in a `404 Not Found` response NotFound (client): 404 Not Found (Request-ID: 36CKBTJ47NCVD9Z1) - <?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>wp-content/blogs.dir/3079/files/</Key><RequestId>36CKBTJ47NCVD9Z1</RequestId><HostId>chtRRi392IiJ/hSDe4c+GAOezjbaaP1iRhGw3XGT4FxTvkOT4WNsJBMe/QaEYhryweckfgXucCE=</HostId></Error> in /var/www/webroot/ROOT/wp-content/plugins/s3-uploads/inc/class-stream-wrapper.php on line 980
[27-Jan-2025 20:05:49 UTC] PHP Warning:  getimagesize(s3://files.commons.gc.cuny.edu/wp-content/blogs.dir/3079/files/): Failed to open stream: &quot;S3_Uploads\Stream_Wrapper::stream_open&quot; call failed in /var/www/webroot/ROOT/wp-content/themes/academica/inc/customizer/logo.php on line 150

Here's the relevant part of the codebase: https://github.com/cuny-academic-commons/cac/blob/ab594405e0a6412a058bf204968cbb9993775202/wp-content/themes/academica/inc/customizer/logo.php#L150

It appears that the $path is getting built to be something like: 's3://files.commons.gc.cuny.edu/wp-content/blogs.dir/3079/files/'. This of course is not a full file path. I'm guessing this means that _wp_attached_file is empty for some reason. This is a broader kind of problem with the Academica theme. The S3-specific part is that the file_exists() check seems to return true for this sort of path, which is why it continues to the getimagesize() call.

It may be that it's not worth fixing this, but I wanted to document it because it's coming up not infrequently in the error logs.

No data to display

Actions

Also available in: Atom PDF