Author: ed
Description:
In writing an extension to implement a filerepo which uses the Amazon S3 system, I found that there were a few changes needed to the File class. This is because the File class assumes that it knows how to calculate the URL based on the hash directory and so forth. In the case of the S3 system, the URL may need a "signature", which is a suffix to the normal URL of the desired file. This affected the links presented on the ImagePage screen for the archive files.
To make a long story short, I added a couple of lines to the beginning of the File::getArchiveUrl() method:
if(is_callable(array($this->repo,'getArchiveUrl'))) { $path = $this->repo->getArchiveUrl($this, $suffix); return $path; }
With this change, the repo, if the corresponding method exists, is used to calculate the URL for the archive files, allowing for signatures, etc.
With just this change, my S3 extension works. But I noticed that there are other methods in the File class which have the same problem, but I am unsure what effect they might have. Also, it is possible that the ImagePage screen creates the file object incorrectly (the "object factory" should be used, and it isn't, so the inheritance doesn't apply).
Anyway, I would like to publish my S3 extension, but I would need to know if this change can be made to the File::getArchiveUrl() method, or if some other change would be better.
Version: 1.15.x
Severity: enhancement