Skip to content
  • Alexander (asac) Sack's avatar
    Add support for creating links for objects during write operations · 6a051ed8
    Alexander (asac) Sack authored
    Autolinking can be disabled with the "autolink=no" query parameter
    when calling api endpoints.
    
    If autolinking is enabled, any object that otherwise would return an error
    that it does not exist, will also consider objects owned by other users
    that are linked from a public device trail.
    
    With this patch the following write operations will not fail anymore
    if objects do not exist, but can be linked:
    
     * create step state that references objects with post to /trails/:id/steps/
     * post trail with factory step with post to /trails/
     * update trail step state for steps still in NEW state with put to /trails/:id/steps/:rev/state
     * create objects through post to /objects hierarchy
     * create objects through post to /trails/:id/steps/:rev/objects
     * update object meta info with put to /objects/:id
    
    To support client convenience we add Http Header Pantahub-Object-Type to indicate if an object
    is a link or a real object on all put/post and get operations related to objects.
    
    To support legacy clients that do not know about links we add compatible behaviour for uploding
    to linked objects that would not store the uploaded file, but only validate the uploade SHA:
    
     * enable SHAONLY fileupload storageID to support --force push in pvr versions that dont
       understand the link semantic
    6a051ed8