Thanks to visit codestin.com
Credit goes to github.com

Skip to content

use os.path.basename() in filename_to_doi#87

Merged
mpacer merged 1 commit into
PLOS:masterfrom
eseiver:filename_to_doi
Feb 27, 2018
Merged

use os.path.basename() in filename_to_doi#87
mpacer merged 1 commit into
PLOS:masterfrom
eseiver:filename_to_doi

Conversation

@eseiver

@eseiver eseiver commented Feb 27, 2018

Copy link
Copy Markdown
Collaborator

this fixes the bug @egh found in #84.
to handle the full filepath, os.path.basename must be used for the filename to DOI transformation to work.

@eseiver eseiver requested a review from mpacer February 27, 2018 00:43
Comment thread allofplos/transformations.py Outdated
"""
if correction in filename and validate_filename(filename):
article = 'annotation/' + (filename.split('.', 4)[2])
article = 'annotation/' + ((os.path.basename(filename)).split('.', 4)[2])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not do filename = os.path.basename(filename) before if correction in filename and validate_filename(filename):?

@mpacer

mpacer commented Feb 27, 2018

Copy link
Copy Markdown
Collaborator

interactive rebase to squash these into one commit? then it looks good to go.

@mpacer

mpacer commented Feb 27, 2018

Copy link
Copy Markdown
Collaborator

Closes #84

@mpacer mpacer merged commit 61b25b3 into PLOS:master Feb 27, 2018
@eseiver eseiver added this to the 0.11.0 milestone Feb 27, 2018
@eseiver eseiver deleted the filename_to_doi branch February 27, 2018 03:00
@egh

egh commented Feb 27, 2018

Copy link
Copy Markdown
Contributor

Thank you!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants