Bugzilla – Attachment 92353 Details for
Bug 20254
Forbid the download of duplicate EDI messages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20254: Do not ingest files with duplicate filenames
Bug-20254-Do-not-ingest-files-with-duplicate-filen.patch (text/plain), 1.52 KB, created by
Kyle M Hall (khall)
on 2019-08-19 18:42:39 UTC
(
hide
)
Description:
Bug 20254: Do not ingest files with duplicate filenames
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2019-08-19 18:42:39 UTC
Size:
1.52 KB
patch
obsolete
>From 59d53162106c6be2e533bc5adfd3997499f32ae6 Mon Sep 17 00:00:00 2001 >From: Colin Campbell <colin.campbell@ptfs-europe.com> >Date: Wed, 24 Jan 2018 09:20:12 +0000 >Subject: [PATCH] Bug 20254: Do not ingest files with duplicate filenames > >If the supplier delivers the same file twice we are >unable to rename it on the second occurence causing us to download >and process it infinitely. > >Check that downloaded filenames are unique against those >on file and reject processing if a duplicate. > >This patch delays this check to the ingest stage so that the >same code is processed irrespective of transport > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Edifact/Transport.pm | 9 +++++++++ > 1 file changed, 9 insertions(+) > >diff --git a/Koha/Edifact/Transport.pm b/Koha/Edifact/Transport.pm >index 036dbc2ae9..f53017bc39 100644 >--- a/Koha/Edifact/Transport.pm >+++ b/Koha/Edifact/Transport.pm >@@ -182,6 +182,15 @@ sub sftp_download { > sub ingest { > my ( $self, $msg_hash, @downloaded_files ) = @_; > foreach my $f (@downloaded_files) { >+ >+ # Check file has not been downloaded already >+ my $existing_file = $self->{schema}->resultset('EdifactMessage') >+ ->find( { filename => $f, } ); >+ if ($existing_file) { >+ carp "skipping ingest of $f : filename exists"; >+ next; >+ } >+ > $msg_hash->{filename} = $f; > my $file_content = > read_file( "$self->{working_dir}/$f", binmode => ':raw' ); >-- >2.20.1 (Apple Git-117)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20254
:
74002
|
83013
|
83014
|
83015
|
91412
|
91413
|
91414
| 92353 |
92354
|
92355