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

Upload should take URL pointing to media #12590

Closed
2 tasks
sjoukedv opened this issue Feb 18, 2022 · 4 comments
Closed
2 tasks

Upload should take URL pointing to media #12590

sjoukedv opened this issue Feb 18, 2022 · 4 comments
Labels
issue: feature request Issue suggesting a new feature source: core:upload Source is core/upload package

Comments

@sjoukedv
Copy link
Contributor

Feature request

Please describe your feature request

  • I have created my request on the Product Board before I submitted this issue
  • I have looked at all the other requests on the Product Board before I submitted this issue

Summary

Upload endpoint should be able to handle URLs pointing to a media resource both on Upload files related to an entry and Upload file during entry creation

Why is it needed?

Typically API responses contains URLs to media such that they can be served from a CDN (just like Strapi itself). If I want to insert these entries programatically I first have to retrieve the image myself instead of passing the URL along.

@kasonde
Copy link
Contributor

kasonde commented Feb 22, 2022

I fear theres a possiblity that this feature request would essentially deviate from the fact that media entities are represented in the database as records and their relative path stored in the database. We use IDs as the source of truth because they typically never change

@sjoukedv
Copy link
Contributor Author

Okay, I would like the POST /api/upload endpoint to also take URLs as data instead the 'file' directly, similar to the upload from URL in the admin panel (so the functionality is already there in the admin panel, but not in the API).

Even more useful would be to accept an (external) URL when creating an entry for a collection which contains a link to media content.

The above is regardless of how it is stored under the hood, e.g. for a media field of a collection check if the attribute is a (valid) URL and insert that into the media library. Even more concrete example for the restaurants example in the docs:

It has an image field which points to a media entry then POST http://localhost:1337/api/restaurants should take

{
  "data": {
    "title": "Hello",
    "image": "https://images.pexels.com/photos/6267/menu-restaurant-vintage-table.jpg
    "relation": 2,
    "relations": [2, 4],
    "link": {
      "id": 1,
      "type": "abc"
    }
  }
}

@derrickmehaffy derrickmehaffy added issue: feature request Issue suggesting a new feature source: core:upload Source is core/upload package labels Feb 23, 2022
@derrickmehaffy derrickmehaffy added this to To be reviewed (Open) in Content - Old via automation Feb 23, 2022
@petersg83
Copy link
Contributor

Hi @sjoukedv,
The url feature you see in the admin panel works only on the front-end part of Strapi, not in the back-end part.
We used to do it in the back-end but there were some security issues that I don't remember that made us remove it. It was removed in this PR #8442.
So I think it is unlikely that we would propose this feature again.

@derrickmehaffy
Copy link
Member

Not something we will do, marking as closed

Content - Old automation moved this from To be reviewed (Open) to Fixed/Shipped Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: feature request Issue suggesting a new feature source: core:upload Source is core/upload package
Projects
No open projects
Content - Old
Fixed/Shipped
Development

No branches or pull requests

4 participants