Skip to content

Commit

Permalink
Fix a potential issue with unset dictionary file
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesname committed Mar 15, 2022
1 parent e1a9400 commit 7075098
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion controllers/FilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ public function importAction()
move_uploaded_file($_FILES["file"]["tmp_name"], $path);

$dict_path = null;
if ($form->getElement("enhance")->isChecked() && isset($_FILES["enhance_dict"]["tmp_name"])) {
if ($form->getElement("enhance")->isChecked()
&& isset($_FILES["enhance_dict"]["tmp_name"])
&& !empty($_FILES["enhance_dict"]["tmp_name"])) {
$dict_path = $temp . DIRECTORY_SEPARATOR . $_FILES['enhance_dict']['name'];
move_uploaded_file($_FILES["enhance_dict"]["tmp_name"], $dict_path);
}
Expand Down
1 change: 1 addition & 0 deletions helpers/TeiEditions_Helpers_DataFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class TeiEditions_Helpers_DataFetcher
function __construct($dict_path = null, $lang = 'eng', $opts = array())
{
if ($dict_path) {
error_log("Loading dictionary path: $dict_path");
$doc = TeiEditions_Helpers_DocumentProxy::fromUriOrPath($dict_path);
foreach ($doc->entities() as $entity) {
$this->dict[$entity->ref()] = $entity;
Expand Down
2 changes: 1 addition & 1 deletion helpers/TeiEditions_Helpers_DataImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function importData($path, $mime, $neatline, $enhance, &$created, &$updat
$tx->commit();
} catch (Exception $e) {
$tx->rollBack();
throw new TeiEditions_Helpers_ImportError("Error importing file: $name", 0, $e);
throw new TeiEditions_Helpers_ImportError("Error importing file: $name: " . $e->getMessage(), 0, $e);
} finally {
$onDone();
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tei-editions",
"description": "An Omeka plugin for importing and rendering structured TEI files for EHRI digital editions.",
"version": "1.0.0-pre4",
"version": "1.0.0-pre5",
"devDependencies": {
"grunt": "^1.3.0",
"grunt-cli": "^1.3.2",
Expand Down
2 changes: 1 addition & 1 deletion plugin.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ link="https://github.com/EHRI/TeiEditions"
support_link="https://github.com/EHRI/TeiEditions/issues"
omeka_minimum_version="2.6"
omeka_target_version="2.6"
version="1.0.0-pre4"
version="1.0.0-pre5"

0 comments on commit 7075098

Please sign in to comment.