Skip to content

Hash should optionally be included in the save model output #1453

Open
@krassowski

Description

@krassowski

Problem

Contents manager get() method now supports require_hash option and returns hash if queried with require_hash=True:

def get(self, path, content=True, type=None, format=None, require_hash=False):

however save() does not support require_hash and frontend needs to update the hash after each save leading to rather inelegant and resource-wasting frontend implementation:

this._manager.contents 
   .save(path, options) 
   .then(async contentsModel => { 
     const model = await this._manager.contents.get(path, { 
       content: false, 
       hash: true 
     }); 
     return { 
       ...contentsModel, 
       hash: model.hash, 
       hash_algorithm: model.hash_algorithm 
     } as Contents.IModel; 

Proposed Solution

Support require_hash in save() method of the contents manager (and expose it via REST API).

Additional context

This is the case since:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions