Bug Report
Current Behavior
When using the Imgur image upload, those files cannot be deleted any more
Currently, this is not implemented:
|
/** |
|
* In case deletion is not possible, return false. |
|
* |
|
* @param File $file |
|
* |
|
* @return File|bool |
|
*/ |
|
public function delete(File $file) |
|
{ |
|
// TODO: Implement delete() method. |
|
|
|
return false; |
|
} |
The Imgur deletion API for anonymous image uploads (as used in this plugin) requires the deleteHash, which is returned upon image upload
At the moment, the plugin does not store this value:
|
// successful upload, let's get the generated URL |
|
if ($response->getStatusCode() == 200) { |
|
$meta = Arr::get(json_decode($response->getBody(), true), 'data', []); |
|
|
|
$link = Arr::get($meta, 'link'); |
|
|
|
$file->url = $link; |
|
$file->remote_id = Arr::get($meta, 'id'); |
|
} |
Expected Behavior
Users (or at least admins) can delete images that have been uploaded using the Imgur integration
Environment
- Flarum version: 1.8.8
- Extension version: 1.5.5
Possible solution(s)
I don't know the internals of this plugin, but maybe the deleteHash could be stored in the remote_id instead of the id (unless the remote_id is used for some other purpose):
|
$file->remote_id = Arr::get($meta, 'id'); |
Additional Context
Related issue: #290
Bug Report
Current Behavior
When using the Imgur image upload, those files cannot be deleted any more
Currently, this is not implemented:
upload/src/Adapters/Imgur.php
Lines 81 to 93 in e8e7f9f
The Imgur deletion API for anonymous image uploads (as used in this plugin) requires the
deleteHash, which is returned upon image uploadAt the moment, the plugin does not store this value:
upload/src/Adapters/Imgur.php
Lines 64 to 72 in e8e7f9f
Expected Behavior
Users (or at least admins) can delete images that have been uploaded using the Imgur integration
Environment
Possible solution(s)
I don't know the internals of this plugin, but maybe the
deleteHashcould be stored in theremote_idinstead of theid(unless theremote_idis used for some other purpose):upload/src/Adapters/Imgur.php
Line 71 in e8e7f9f
Additional Context
Related issue: #290