Skip to content

Problem: csv:digital-object-path-check wrongly complains about unused and missing files #1923

Open
@miceno

Description

@miceno

Current Behavior

Run the csv:digital-object-path-check from the CLI using the following data:

Content of image folder is:

[atom@public_html]$ tree /tmp/folderimage/
/tmp/folderimage/
├── dir1
│   └── file2.png
└── file1.png

1 directory, 2 files

Import CSV file is:

[atom@public_html]$ cat /tmp/images.csv 
filename
file1.png
dir1/file2.png
[atom@public_html]$ php74 -d memory_limit=-1 symfony csv:digital-object-path-check -n filename /tmp/folderimage /tmp/images.csv
>> digital-object-path-check Checking filename column.
Unused files:
* dir1/file2.png

Files referenced in CSV that are missing:
* file2.png

The command wrongly complains about unused files and missing files 😢

Expected Behavior

Run the csv:digital-object-path-check from the CLI using the following data:

Content of image folder is:

[atom@public_html]$ tree /tmp/folderimage/
/tmp/folderimage/
├── dir1
│   └── file2.png
└── file1.png

1 directory, 2 files

Import CSV file is:

[atom@public_html]$ cat /tmp/images.csv 
filename
file1.png
dir1/file2.png
[atom@public_html]$ php74 -d memory_limit=-1 symfony csv:digital-object-path-check -n filename /tmp/folderimage /tmp/images.csv
>> digital-object-path-check Checking filename column.

NO unused files nor message should appear.

Possible Solution

The problem is the way the list of images is obtained, since the code is performing a basename for each file!!!!!! This is really bad 👎

The solution is trivial, just removing the basename call will be enough... I am preparing a PR to solve it.

Context and Notes

I am afraid there is no testing code on this part of the code, since the change is there since 2022... Or people is not using this command at all.

Version used

AtoM 2.8.2

Operating System and version

No response

Default installation culture

en,ca,es

PHP version

PHP 7.4

Contact details

contact me at @miceno

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bugA flaw in the code that causes the software to produce an incorrect or unexpected result.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions