Fix #1349 (Fix error on move cover with foreign file systems, e.g. samba shares)

Preparation for release
This commit is contained in:
Ozzieisaacs 2020-05-05 18:55:28 +02:00
parent 850a85915b
commit 0735fb1e92
3 changed files with 48 additions and 43 deletions

View File

@ -129,7 +129,7 @@ def selected_roles(dictionary):
BookMeta = namedtuple('BookMeta', 'file_path, extension, title, author, cover, description, tags, series, '
'series_id, languages')
STABLE_VERSION = {'version': '0.6.7 Beta'}
STABLE_VERSION = {'version': '0.6.7'}
NIGHTLY_VERSION = {}
NIGHTLY_VERSION[0] = '$Format:%H$'

View File

@ -702,16 +702,11 @@ def upload():
return Response(json.dumps({"location": url_for("web.index")}), mimetype='application/json')
try:
copyfile(meta.file_path, saved_filename)
except OSError:
log.error("Failed to store file %s (Permission denied)", saved_filename)
flash(_(u"Failed to store file %(file)s (Permission denied).", file=saved_filename), category="error")
return Response(json.dumps({"location": url_for("web.index")}), mimetype='application/json')
try:
os.unlink(meta.file_path)
except OSError:
log.error("Failed to delete file %(file)s (Permission denied)", meta.file_path)
flash(_(u"Failed to delete file %(file)s (Permission denied).", file= meta.file_path),
category="warning")
except OSError as e:
log.error("Failed to move file %s: %s", saved_filename, e)
flash(_(u"Failed to Move File %(file)s: %(error)s", file=saved_filename, error=e), category="error")
return Response(json.dumps({"location": url_for("web.index")}), mimetype='application/json')
if meta.cover is None:
has_cover = 0
@ -719,7 +714,15 @@ def upload():
os.path.join(filepath, "cover.jpg"))
else:
has_cover = 1
move(meta.cover, os.path.join(filepath, "cover.jpg"))
try:
copyfile(meta.cover, os.path.join(filepath, "cover.jpg"))
os.unlink(meta.cover)
except OSError as e:
log.error("Failed to move cover file %s: %s", os.path.join(filepath, "cover.jpg"), e)
flash(_(u"Failed to Move Cover File %(file)s: %(error)s", file=os.path.join(filepath, "cover.jpg"),
error=e),
category="error")
return Response(json.dumps({"location": url_for("web.index")}), mimetype='application/json')
# handle authors
is_author = db.session.query(db.Authors).filter(db.Authors.name == authr).first()

66
test/Calibre-Web TestSummary.html Normal file → Executable file
View File

@ -36,17 +36,17 @@
<div class="col-xs-12 col-sm-6">
<div class="row">
<div class="col-xs-6 col-md-6 col-sm-offset-3" style="margin-top:50px;">
<p class='text-justify attribute'><strong>Start Time: </strong>2020-05-01 13:35:57</p>
<p class='text-justify attribute'><strong>Start Time: </strong>2020-05-05 19:02:03</p>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-md-6 col-sm-offset-3">
<p class='text-justify attribute'><strong>Stop Time: </strong>2020-05-01 14:32:26</p>
<p class='text-justify attribute'><strong>Stop Time: </strong>2020-05-05 19:58:37</p>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-md-6 col-sm-offset-3">
<p class='text-justify attribute'><strong>Duration: </strong>47:49 min</p>
<p class='text-justify attribute'><strong>Duration: </strong>47:42 min</p>
</div>
</div>
</div>
@ -1829,8 +1829,8 @@ AssertionError: False is not true : logfile config value is not empty after rese
<tr class="result['header']['style']">
<td>test_updater.test_updater</td>
<td class="text-center">7</td>
<td class="text-center">6</td>
<td class="text-center">0</td>
<td class="text-center">5</td>
<td class="text-center">1</td>
<td class="text-center">0</td>
<td class="text-center">1</td>
<td class="text-center">
@ -1867,11 +1867,33 @@ AssertionError: False is not true : logfile config value is not empty after rese
<tr id='pt18.4' class='hiddenRow bg-success'>
<tr id='ft18.4' class='none bg-danger'>
<td>
<div class='testcase'>test_check_update_stable_versions</div>
</td>
<td colspan='6' align='center'>PASS</td>
<td colspan='6'>
<div class="text-center">
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_ft18.4')">FAIL</a>
</div>
<!--css div popup start-->
<div id='div_ft18.4' class="popup_window test_output" style="display:none;">
<div class='close_button pull-right'>
<button type="button" class="close" aria-label="Close" onfocus='this.blur();'
onclick="document.getElementById('div_ft18.4').style.display='none'"><span
aria-hidden="true">&times;</span></button>
</div>
<div class="text-left pull-left">
<pre class="text-left">Traceback (most recent call last):
File "/home/matthias/Entwicklung/calibre-web-test/test/test_updater.py", line 150, in test_check_update_stable_versions
self.check_updater('latest version installed', "alert-warning")
File "/home/matthias/Entwicklung/calibre-web-test/test/test_updater.py", line 60, in check_updater
self.assertTrue(self.check_element_on_page((By.CLASS_NAME, className)))
AssertionError: False is not true</pre>
</div>
<div class="clearfix"></div>
</div>
<!--css div popup end-->
</td>
</tr>
@ -1924,8 +1946,8 @@ AssertionError: False is not true : logfile config value is not empty after rese
<tr class="result['header']['style']">
<td>test_user_template.test_user_template</td>
<td class="text-center">19</td>
<td class="text-center">18</td>
<td class="text-center">1</td>
<td class="text-center">19</td>
<td class="text-center">0</td>
<td class="text-center">0</td>
<td class="text-center">0</td>
<td class="text-center">
@ -2088,31 +2110,11 @@ AssertionError: False is not true : logfile config value is not empty after rese
<tr id='ft19.18' class='none bg-danger'>
<tr id='pt19.18' class='hiddenRow bg-success'>
<td>
<div class='testcase'>test_series_user_template</div>
</td>
<td colspan='6'>
<div class="text-center">
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_ft19.18')">FAIL</a>
</div>
<!--css div popup start-->
<div id='div_ft19.18' class="popup_window test_output" style="display:none;">
<div class='close_button pull-right'>
<button type="button" class="close" aria-label="Close" onfocus='this.blur();'
onclick="document.getElementById('div_ft19.18').style.display='none'"><span
aria-hidden="true">&times;</span></button>
</div>
<div class="text-left pull-left">
<pre class="text-left">Traceback (most recent call last):
File "/home/matthias/Entwicklung/calibre-web-test/test/test_user_template.py", line 193, in test_series_user_template
self.assertTrue(self.check_element_on_page((By.ID, "nav_hot")))
AssertionError: False is not true</pre>
</div>
<div class="clearfix"></div>
</div>
<!--css div popup end-->
</td>
<td colspan='6' align='center'>PASS</td>
</tr>
@ -2574,7 +2576,7 @@ AssertionError: False is not true</pre>
<tr>
<th>SQLAlchemy-Utils</th>
<td>0.36.4</td>
<td>0.36.5</td>
<td>test_OAuth_login</td>
</tr>