How to specify the latest version when attaching an NRS to a versioned FilesContainer?

If you execute the following command:

safe files put build/

This will output the following:

FilesContainer created at: "safe://blahblah"

If you then try to use this FilesContainer to create an NRS, as such:

safe nrs create blah -l blahblah

You will get an error:

InvalidInput - The linked content (FilesContainer) is versionable, therefore NRS requires the link to specify a version

This error is fine and can be specified by selecting a version, for instance:

safe nrs create blah -l blahblah?v=1

But how would you anchor the NRS to the latest version? Essentially, I want to do something similar to:

safe nrs create blah -l blahblah?v=latest

So that whenever a user accesses the FilesContainer stored within the blah NRS, they are presented the latest version of the contained files.

Cheers,
Shane

2 Likes

That’s how we defined so NRS URLs are also perpetual, so by convention the NRS resolver doesn’t accept links which don’t have a version, and the NRS container also is versioned, that way when you use an NRS URL with a version you can still access the verson of the FilesContainer was linked to before.

To update the NRS name automatically when updating a website/FilesContainer, you can use the --update-nrs of the files sync command in the CLI, which automatically updates the NRS name to link to the new version of the FilesContainer being synced/updated. This generates a new version of the NRS name. If you give it a try with a CLI you’ll see what I mean.

2 Likes

Cheers for that, it gave me all of the information I needed to continue. :slight_smile:

2 Likes

This topic was automatically closed after 60 days. New replies are no longer allowed.