Skip to content

Commit 6fc866e

Browse files
committed
Fixed bug in integrity check
1 parent 7ba8e75 commit 6fc866e

File tree

1 file changed

+3
-12
lines changed
  • csv-validator-core/src/main/scala/uk/gov/nationalarchives/csv/validator

1 file changed

+3
-12
lines changed

csv-validator-core/src/main/scala/uk/gov/nationalarchives/csv/validator/Util.scala

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -215,18 +215,9 @@ object Util {
215215
}
216216

217217
private def contentDir(filepath: String, topLevelFolder: String): String = {
218-
val dir = pathSubstitutions.collectFirst{
219-
case (subFrom, subTo) if filepath.contains(subFrom) => FileSystem.file2PlatformIndependent(subTo)
220-
} getOrElse {
221-
(filepath split topLevelFolder).head
222-
}
223-
224-
val sep = "/"
225-
val lastfilePath = dir.split(sep).last
226-
if (lastfilePath.equals(topLevelFolder) || lastfilePath.equals(topLevelFolder + sep)) {
227-
dir
228-
} else
229-
FileSystem.file2PlatformIndependent(dir + sep + topLevelFolder)
218+
val dir = (substitutePath(filepath) split topLevelFolder).head
219+
val sep = "/"
220+
FileSystem.file2PlatformIndependent(dir + sep + topLevelFolder)
230221
}
231222

232223
def jointPath: String = {

0 commit comments

Comments
 (0)