Replies: 15 comments
|
Hi @Amniotic3 You can see the original repository has the same code: https://github.com/zotero/dataserver/blob/master/model/Item.inc.php#L1477
Custom changes made via files in https://github.com/uniuuu/zotprime/tree/development/stack/dataserver/config Could you please share how to reproduce this error? |
|
@uniuuu Good afternoon, I've been busy getting continuing education credits lately, so I apologize for not getting back in a timely manner. I'm using a client-side build under the ZotPrime 2.8.2-rc/production branch, and after logging into my admin account, clicking on the sync button, then dragging and dropping a pdf copy of the journal in, reading it in zotero's native reader, adding highlighted notes, and then clicking on sync, and the error comes up. |
|
fix this bug. look the log question is here: /**
* Get the MIME type of an attachment (e.g. 'text/plain')
*/
private function getAttachmentMIMEType() {
if (!$this->isAttachment()) {
trigger_error("attachmentMIMEType can only be retrieved for attachment items", E_USER_ERROR);
}
if ($this->attachmentData['mimeType'] !== null) {
return $this->attachmentData['mimeType'];
}
if (!$this->id) {
return '';
}
$sql = "SELECT mimeType FROM itemAttachments WHERE itemID=?";
$stmt = Zotero_DB::getStatement($sql, true, Zotero_Shards::getByLibraryID($this->libraryID));
$mimeType = Zotero_DB::valueQueryFromStatement($stmt, $this->id);
if (!$mimeType) {
$mimeType = '';
}
// TEMP: Strip some invalid characters
$mimeType = iconv("UTF-8", "ASCII//IGNORE", $mimeType);
$mimeType = preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', '', $mimeType);
$this->attachmentData['mimeType'] = $mimeType;
return $mimeType;
}rewrite to this: private function getAttachmentMIMEType() {
if (!$this->isAttachment()) {
trigger_error("attachmentMIMEType can only be retrieved for attachment items", E_USER_ERROR);
}
if ($this->attachmentData['mimeType'] !== null) {
return $this->attachmentData['mimeType'];
}
if (!$this->id) {
return '';
}
$sql = "SELECT mimeType FROM itemAttachments WHERE itemID=?";
$stmt = Zotero_DB::getStatement($sql, true, Zotero_Shards::getByLibraryID($this->libraryID));
$mimeType = Zotero_DB::valueQueryFromStatement($stmt, $this->id);
if (!$mimeType) {
$mimeType = '';
} else {
try {
$mimeType = mb_convert_encoding($mimeType, "ASCII", "UTF-8");//fix bug
} catch (Exception $e) {
error_log("[ERROR] iconv conversion failed for mimeType: $mimeType. Error: " . $e->getMessage());
}
$mimeType = preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', '', $mimeType);
if (!preg_match('/^[a-zA-Z0-9\-\.]+\/[a-zA-Z0-9\-\.]+$/', $mimeType)) {
error_log("[ERROR] Invalid mimeType format: $mimeType. Setting to empty.");
$mimeType = '';
}
}
$this->attachmentData['mimeType'] = $mimeType;
return $mimeType;
} |
|
Checking the server-side database, I can find that mimeType has a specific data type, but after the when we add an annotation for uploading and synchronizing because the So whether you are annotating a PDF document or not, it will report an error that the parent item is not a PDF document. |
|
Hi @Amniotic3 The custom files made within zotprime are located in stack/dataserver/config/ But stack/dataserver/dataserver is pointing to fork of the original dataserver repository https://github.com/zotero/dataserver Therefore to fix it best is to submit bug to zotero. @Amniotic3 Can see that there is new commit from zotero dataserver maintaners zotero/dataserver@6ed5455 regarding "Fix "0" for annotation field being removed" |
Added this commit under https://github.com/uniuuu/zotprime/tree/v2.8.4 |
|
Hi @Amniotic3 |
|
Oh dear friend, sorry, I thought I had made this clear. It's like this, with the help of GPT, I added multiple debug hints and found out that the reason for this is that the loss of the highlighted parent item here comes from an error in the The problem is in this code:
At GPT's suggestion, modifying the iconv function to mb_convert_encoding solved the problem.
Meta-information replacement then no longer gives errors. |
|
Aha, been pouring over how to do HTTPS deployments for the past few days, super buggy and headache to change 😭 |
|
I'm even wondering if it's possible to replicate the functionality of zotero's official website, such as account registration, password changes, maintenance of group permissions, and so on. The command line approach is still pretty geeky, and other members of the team have been giving me feedback on whether or not it could be UI-ized. |
For GitHub use is really not a big conference, in addition to this account is a blank no trace of the account, I guess it is not very easy to gain trust, so I will not try haha. |
|
@Amniotic3 It's done trough next forum https://forums.zotero.org/discussions and not github, please check.
|
|
Let's keep open this issue. I'll be reviewing it too. |
Hi @Amniotic3 I've reviewed all these and yes indeed they were issues not at zotprime code but dataserver code that's maintained by zotero team. zotprime pulls this code with minimal changes via patches to allow self-hosted compatibility. So if any such issue need to request at the zotero forum.
This is interesting and seems demanded. |

Uh oh!
There was an error while loading. Please reload this page.
I checked the local SQLite database, looking for this PDF document, under the itemAttachments form, the value of contentType is
application/pdf, check the relevant code, there seems to be no obvious logic error, special report this bug, affecting PDF batch reading function.All reactions