Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Can't delete files #125

@dongennl

Description

@dongennl

Hi, I'm probably missing something obvious but I can't get my files deleted; everything else works. (arc 0.11.0; arc_gcs 0.2.3)

Here's my uploader

defmodule Forluxury.Image do
  use Arc.Definition
  use Arc.Ecto.Definition

  @versions [:original, :thumb]
  @acl :public_read

  def transform(:thumb, _) do
    {:convert, "-resize 75x75 -background white -gravity center -extent 75x75"}
  end

  def transform(:original, _) do
    {:convert, "-resize 350x350 -background white -gravity center -extent 350x350"}
  end

  def filename(version, _) do
    version
  end

  def storage_dir(_version, {_file, scope}) do
    if scope do
      "images/#{scope.auction_id}/#{scope.image_uuid}"
    end
  end

  def __storage, do: Arc.Storage.GCS

  def gcs_object_headers(_, {file, _scope}) do
    [content_type: MIME.from_path(file.file_name)]
  end
end

the fields auction_id & image_uuid exist in the db and are populated (the generated URLs are correct); I don't delete the db record before trying to delete the file.

in iex:

path = Forluxury.Image.url({img.image, img}, :thumb)
"https://storage.googleapis.com/ddd-images-dev/images/6b00f8c4-805b-4c7d-be4a-b3c34f60e7f8/e59279d8-37b1-11eb-aaa3-7c6d628fbb76/thumb.JPG?v=63774471479"
Image.delete({path, img})
:ok

I'm not sure what I'm missing, but it just ignores the delete. I've also tried removing the "?v=xxxx" bit, same result. Same for the 'original' version or no version specified.
My service account has "Storage Object Admin" and "Storage Object Creator" permissions.

Any pointers greatly appreciated or how I could further diagnose this. I'm not sure what else to try.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions