Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Uploading file to collection with alternative primary key fails #671

Closed
rijkvanzanten opened this issue Dec 24, 2018 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@rijkvanzanten
Copy link
Member

Bug Report

When you have a collection that uses a primary key that's called something else then id, uploading a file fails. This is due to the fact that the API tries to use the name of the primary key field of the collection in directus_files, which fails:

{
    "error": {
        "code": 9,
        "message": "Failed generating the SQL query.",
        "query": "SELECT `directus_files`.`id` AS `id`, `directus_files`.`storage` AS `storage`, `directus_files`.`filename` AS `filename`, `directus_files`.`title` AS `title`, `directus_files`.`type` AS `type`, `directus_files`.`uploaded_by` AS `uploaded_by`, `directus_files`.`uploaded_on` AS `uploaded_on`, `directus_files`.`charset` AS `charset`, `directus_files`.`filesize` AS `filesize`, `directus_files`.`width` AS `width`, `directus_files`.`height` AS `height`, `directus_files`.`duration` AS `duration`, `directus_files`.`embed` AS `embed`, `directus_files`.`folder` AS `folder`, `directus_files`.`description` AS `description`, `directus_files`.`location` AS `location`, `directus_files`.`tags` AS `tags`, `directus_files`.`metadata` AS `metadata` FROM `directus_files` WHERE `q_nummer` = '' LIMIT 1"
    }
}

The WHERE q_nummer = '' is wrong. I think this is supposed to be WHERE id = '1'.

@rijkvanzanten rijkvanzanten added the bug Something isn't working label Dec 24, 2018
@wellingguzman wellingguzman added this to Needs triage in Bug Triage Dec 25, 2018
@wellingguzman wellingguzman moved this from Needs triage to High priority in Bug Triage Dec 25, 2018
@wellingguzman wellingguzman added this to To do in v2.0.14 Dec 25, 2018
@wellingguzman wellingguzman moved this from To do to In progress in v2.0.14 Dec 25, 2018
Bug Triage automation moved this from High priority to Closed Dec 25, 2018
v2.0.14 automation moved this from In progress to Done Dec 25, 2018
@rijkvanzanten
Copy link
Member Author

Super quick fix, well done @wellingguzman 👏🏻

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
Bug Triage
  
Closed
v2.0.14
  
Done
Development

No branches or pull requests

1 participant