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

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

Open
krassowski opened this issue Aug 18, 2024 · 0 comments
Open

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

krassowski opened this issue Aug 18, 2024 · 0 comments

Comments

@krassowski
Copy link
Collaborator

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant