Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deletion of Imgur uploads #417

Open
tipa opened this issue Nov 14, 2024 · 0 comments
Open

Add deletion of Imgur uploads #417

tipa opened this issue Nov 14, 2024 · 0 comments
Labels

Comments

@tipa
Copy link

tipa commented Nov 14, 2024

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

@tipa tipa added the bug label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant