Skip to content

Incorrect Early Return in get_opf_path Method in OpenPechaGitRepo Class #269

@gangagyatso4364

Description

@gangagyatso4364

Describe the bug
There's a bug in the get_opf_path method of the OpenPechaGitRepo class where the method prematurely returns the OPF path after calling the download_pecha function. This behavior can lead to other functions and properties trying to access a file that is not the correct OPF path, causing potential file not found errors or incorrect file handling.

To Reproduce
Steps to reproduce the behavior:

  1. Initialize an instance of OpenPechaGitRepo with a valid pecha_id and without a path.
  2. The get_opf_path method is invoked during initialization.
  3. The method calls download_pecha(pecha_id)
  4. The method returns a path that is not the correct OPF path.

Expected behavior
The expected behavior is that the get_opf_path method should correctly handle the scenario where a pecha is being downloaded and the correct opf path is returned. It should ensure that the path returned is the correct OPF path after the download is complete.

Screenshots
the code can be changed to this.
Screenshot from 2024-01-08 16-51-14

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
in the following function an OpenPechaGitRepo object is created. here the property opf.base_names_list is showing an error becuase it is misguided to the pecha folder instead of opf folder because premature return of opf path value.
code:
Screenshot from 2024-01-09 12-29-06

error message:
An error occurred while processing Pecha ID I229815A9: [Errno 2] No such file or directory: '/home/gangagyatso/.openpecha/pechas/I229815A9/base'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions