Git Product home page Git Product logo

Comments (10)

leplatrem avatar leplatrem commented on June 15, 2024

What is the use-case ?

from kinto-attachment.

Natim avatar Natim commented on June 15, 2024

The first use case is for Fennec OTA where we do not want the base_url in records but we want it in the Hello page. Related to Bug 1257882

from kinto-attachment.

almet avatar almet commented on June 15, 2024

I'm not sure it should be the default behaviour, though: it seems easier to have the complete URL of the attachment in the record (no additional operation on the client side, everything can be done with one request).

from kinto-attachment.

Natim avatar Natim commented on June 15, 2024

The reason why I was suggesting it to be the default behavior is to solve the #24 issue which make it complicated to change the base_url with existing records.

from kinto-attachment.

almet avatar almet commented on June 15, 2024

I understand, thanks for pointing that out.

I would prefer to stick with the full URL in the records and for instance a script which updates all the records in case the base_url is updated, as I believe it's a good thing to focus on ease of use of our APIs rather than one-time processes like the change of a setting.

Such script would iterate over all the records in the database, looking for the attachment.location key, and would substitute the old value with the new one.

Would that solve your problem?

from kinto-attachment.

Natim avatar Natim commented on June 15, 2024

I would prefer to stick with the full URL in the records and for instance a script which updates all the records in case the base_url is updated, as I believe it's a good thing to focus on ease of use of our APIs rather than one-time processes like the change of a setting.

The problem with that is that you will update the last_modified value of records where the data didn't changed except in the case where the url is actually the data you want to be notified about.

But in most cases you only want to update the record if the file data changed. That's at least the case in the Fennec OTA case.

In any case if we can handle both cases with the configuration it doesn't matter to me which one is the default one. I genuinely though that people that need to have the full url will know it and that people that are fine with both we be less likely to encounter the base_url update problem.

from kinto-attachment.

almet avatar almet commented on June 15, 2024

So we would have two scenarii when want to update the base_url:

  1. You set prepend_base_url=True (default) in the configuration: a script can iterate on records and update their values and last_modified field;
  2. You set prepend_base_url=False, you need to tell your client to change the base_url. I'm not sure how you detect this on the client side and what should be done then.

Note that I'm not advocating against the idea of removing the base_url from the records. I think it's a good thing to do in some cases. I just thing that this shouldn't be the default behaviour.

from kinto-attachment.

almet avatar almet commented on June 15, 2024

Also, this configuration should be exposed in the root URL and checked by the clients, otherwise they might fail without notice on configuration /server change.

It might also be a good idea to have this option setup by collection/bucket rather than having it server-wide.

from kinto-attachment.

Natim avatar Natim commented on June 15, 2024

It might also be a good idea to have this option setup by collection/bucket rather than having it server-wide.

It can also be configured server-wide by bucket/collection as for kinto-signer.

However I don't see how it could be configured client-side because the server is responsible for putting the data there. So it should be the source of truth that tells where it puts the data.

from kinto-attachment.

almet avatar almet commented on June 15, 2024

I don't see how it could be configured client-side

That's not my proposal :) I was more proposing a configuration per collection, either in the configuration (like what we did for the signer) or in the bucket's data.

from kinto-attachment.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.