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

DOI Upload file is validating DOI name on update #189

Closed
kjgarza opened this issue Apr 11, 2019 · 8 comments
Closed

DOI Upload file is validating DOI name on update #189

kjgarza opened this issue Apr 11, 2019 · 8 comments
Assignees
Labels

Comments

@kjgarza
Copy link
Contributor

kjgarza commented Apr 11, 2019

DOI name shoun'dt be validated on update. Old DOI name might contain values we do not accept anymore.

It seems to be that this is happening in the DOI upload

https://usersnap.com/a/#/datacite/p/datacite-41ebcc0f/581

Front logo Front conversations

@kjgarza
Copy link
Contributor Author

kjgarza commented Apr 12, 2019

So description is being validated with /dois/validate which will send an error if the DOI has a + sign

let url = ENV.API_URL + '/dois/validate';

@mfenner
Copy link
Contributor

mfenner commented Apr 12, 2019

Where is the validation creating an error for a DOI with a + sign?

@kjgarza
Copy link
Contributor Author

kjgarza commented Apr 12, 2019

the API call to /dois/validate is returning

 {source: "doi", title: "Is invalid"}

The request is taking the DOI-name from the DOI model and although it cannot be modified it still has the + sign. So basically is failing in Lupo when one wants to validate metadata with a DOI-name with a + sing

@kjgarza
Copy link
Contributor Author

kjgarza commented Apr 12, 2019

I just noticed that there is a flag in lupo.

unless: :only_validate

Alternatevely maybe we could skip doi-name validation on /dois/validate

https://github.com/datacite/lupo/blob/96a6c2c113f349128d5700c1cd0a224522dbd45c/app/models/doi.rb#L80

  validates_format_of :doi, :with => /\A10\.\d{4,5}\/[-\._;()\/:a-zA-Z0-9\*~\$\=]+\z/, :on => :create

would that be better ??

@mfenner
Copy link
Contributor

mfenner commented Apr 12, 2019

I think you are saying to not check the DOI format when you are validating a DOI that you want to update. Which makes perfect sense to me. We still need the DOI check for the validation of a new DOI.

@mfenner
Copy link
Contributor

mfenner commented Apr 12, 2019

@kristian I think there are two scenarios:

  • DOI exists -> validation of metadata with DOI name containing a + sign should pass
  • DOI does not exist -> validation of metadata with DOI name containing a + sign should fail

In the current implementation both would fail, in your proposed implementation both would pass.

The easiest way to implement this might be to first check for existence of DOI record in validate method in dois controller.

@mfenner mfenner reopened this Apr 12, 2019
@kristian
Copy link

@mfenner, wrong @kristian... guess you meant @kjgarza

@mfenner
Copy link
Contributor

mfenner commented Apr 12, 2019

Sorry, of course. Have a nice weekend.

kjgarza added a commit to datacite/lupo that referenced this issue Apr 13, 2019
DOI exists -> validation of metadata with DOI name containing a + sign should pass
DOI does not exist -> validation of metadata with DOI name containing a + sign should fail

fix datacite/bracco#189
kjgarza added a commit to datacite/lupo that referenced this issue Apr 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants