Skip to content

Commit

Permalink
fix: file asset uploading and deleting (#496)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablohashescobar authored Mar 22, 2023
1 parent f615f8a commit 27b1308
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apiserver/plane/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@
name="user-file-assets",
),
path(
"users/file-assets/user-profile/<str:asset_key>/",
"users/file-assets/<str:asset_key>/",
UserAssetsEndpoint.as_view(),
name="user-file-assets",
),
Expand Down
2 changes: 0 additions & 2 deletions apiserver/plane/api/views/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ def post(self, request):

def delete(self, request, asset_key):
try:
asset_key = "user-profile" + "/" + asset_key
print(asset_key)
file_asset = FileAsset.objects.get(asset=asset_key, created_by=request.user)
# Delete the file from storage
file_asset.asset.delete(save=False)
Expand Down
2 changes: 1 addition & 1 deletion apiserver/plane/db/models/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
def get_upload_path(instance, filename):
if instance.workspace_id is not None:
return f"{instance.workspace.id}/{uuid4().hex}-{filename}"
return f"user-profile/{uuid4().hex}-{filename}"
return f"user-{uuid4().hex}-{filename}"


def file_size(value):
Expand Down

0 comments on commit 27b1308

Please sign in to comment.