You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
my $tmp = Path::Tiny->tempfile
or Catmandu::Error->throw("Could not create temp file");
# For now using a simplistic mirror operation
my $fname = $tmp->stringify;
And then there is a call to a mirror method of the user agent:
my $response = $bagit->user_agent->mirror($url,$fname);
But the problem is that the mirror method will compare the modification time of the file on the server to the newly created temporary file and not fetch the file if the local file (the temp file) is newer, which it is always will be, since it was created just before. So it will never work to fetch the file, resulting in errors like: Failed to mirror https://server.com/x/y/z.pdf to /tmp/qQTuKQcvMq : 304 304
I don't see any way to fix this except to change the code. It seems problematic to use the mirror call for newly created file. Am I misunderstanding something? Is there some other way to make it work? As a temporary workaround, I changed the code locally and set the modification time of the temporary file directly to 0 before the mirror call. This will force the file to be fetched:
#set access and modification time to 0, so mirroring will work:
my $touch_obj = File::Touch->new(
time => 0,
);
$touch_obj->touch($fname);
After this change everything works for us and the files are fetched.
The text was updated successfully, but these errors were encountered:
In the add method a temporary file is created:
And then there is a call to a mirror method of the user agent:
But the problem is that the mirror method will compare the modification time of the file on the server to the newly created temporary file and not fetch the file if the local file (the temp file) is newer, which it is always will be, since it was created just before. So it will never work to fetch the file, resulting in errors like:
Failed to mirror https://server.com/x/y/z.pdf to /tmp/qQTuKQcvMq : 304 304
I don't see any way to fix this except to change the code. It seems problematic to use the mirror call for newly created file. Am I misunderstanding something? Is there some other way to make it work? As a temporary workaround, I changed the code locally and set the modification time of the temporary file directly to 0 before the mirror call. This will force the file to be fetched:
After this change everything works for us and the files are fetched.
The text was updated successfully, but these errors were encountered: