Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL error when importing contact without email address #8227

Closed
abshoff opened this issue Oct 18, 2021 · 2 comments
Closed

SQL error when importing contact without email address #8227

abshoff opened this issue Oct 18, 2021 · 2 comments

Comments

@abshoff
Copy link
Contributor

abshoff commented Oct 18, 2021

If I import a contact without email address in vCard format, an SQL error is thrown. No record is inserted and the following error is reported in error.log.

DB Error: [1364] Field 'email' doesn't have a default value (SQL Query: INSERT INTO `contacts` (`user_id`, `changed`, `del`, `vcard`, `name`, `firstname`, `surname`, `words`) VALUES (1, now(), 0, 'BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Apple Inc.//macOS 11.6//EN\r\nN:Test;Test;;;\r\nFN:Test Test\r\nTEL;TYPE=cell:+491234567890\r\nEND:VCARD', 'Test Test', 'Test', 'Test', ' test 491234567890')) in /shared/roundcube/roundcubemail/program/lib/Roundcube/rcube_db.php on line 566 (POST /?_task=addressbook&_action=import)

I have encountered this issue in Roundcube Webmail 1.5.0 and I used MariaDB/MySQL as the DBMS.

In mysql.initial.sql#L123, the column email is defined as NOT NULL. Since the contact has no email address, the column email is not populated.

Please find attached the vCard that I have tried to import.

Test Test.vcf.txt

In the address book, I am able to create a contact without email address. In this case, the email field in the database contains the empty string. Hence, I assume the vCard parser should set the default value to the empty string. If this is the desired solution, I would be happy to provide a pull request.

@alecpl
Copy link
Member

alecpl commented Oct 19, 2021

I think it could be fixed around here:

@alecpl
Copy link
Member

alecpl commented Oct 19, 2021

Fixed.

@alecpl alecpl closed this as completed Oct 19, 2021
marczi pushed a commit to marczi/roundcubemail that referenced this issue Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants