1Password UI doesn't visualize multiline text fields correctly if they are created via the CLI

varbarian
varbarian
Community Member

Encountered a similar issue to the one described in https://1password.community/discussion/139116/newlines-coming-through-json-not-working?utm_source=community-search&utm_medium=organic-search&utm_term=multiline+text

Here are the different ways I've tried to provide the multiline input to the text field:

some_user@some_pc:~$ cat testing_lines
line1
line2
line3

some_user@some_pc:~$ testinput=$(cat testing_lines)

some_user@some_pc:~$ op item create --vault some_vault --category Database 'type=MySQL'  'title=test_user/testing' "multiple_lines[text]=$testinput" 'port=3306' 'username=test_user' 'password=asd'
ID:          <<ITEM_ID>>
Title:       test_user/testing
Vault:       some_vault (<<VAULT_ID>>)
Created:     now
Updated:     now
Favorite:    false
Version:     1
Category:    DATABASE
Fields:
  type:           MySQL
  port:           3306
  username:       test_user
  password:       asd
  multiple_lines:    line1
                     line2
                     line3

The multiple_lines entry seems to work fine through the output of the 1Password CLI, however through the 1Password UI it looks like this:
line1 line2 line3

If I click on Edit through the UI all lines are concatenated like this:
line1line2line3

If I click on the Copy button in the UI it seems to provide the correct format for the multiple_lines field:

line1
line2
line3

Also tried to provide json file as a template for the item creation in the vault. Here's how:

some_user@some_pc:~$ cat createuserfile
{
    "vault": {
    "id": "<<ID>>"
    },
    "title": "some/user",
    "category": "DATABASE",
    "tags": [
    "sometag"
    ],
    "fields": [
    {
        "id": "notesPlain",
        "label": "notesPlain",
        "purpose": "NOTES",
        "type": "STRING"
    },
    {
        "id": "database_type",
        "label": "type",
        "type": "MENU",
        "value": "mysql"
    },
    {
        "id": "hostname",
        "label": "server",
        "type": "STRING",
        "value": "test.com"
    },
    {
        "id": "port",
        "label": "port",
        "type": "STRING",
        "value": "891231"
    },
    {
        "id": "database",
        "label": "database",
        "type": "STRING",
        "value": "somename"
    },
    {
        "id": "username",
        "label": "username",
        "type": "STRING",
        "value": "user"
    },
    {
        "id": "password",
        "label": "password",
        "type": "CONCEALED",
        "value": "password"
    },
    {
        "id": "sid",
        "label": "SID",
        "type": "STRING"
    },
    {
        "id": "alias",
        "label": "alias",
        "type": "STRING"
    },
    {
        "id": "options",
        "label": "connection options",
        "type": "STRING"
    },
    {
        "id": "<<ID>>",
        "label": "multiple_lines",
        "type": "STRING",
        "value": "line1\nline2\nline3" 
    },
    {
      "id": "notesPlain",
      "type": "STRING",
      "purpose": "NOTES",
      "label": "notesPlain",
      "value": "line1\nline2\nline3"
    }
    ]
}

op item create --template=createuserfile --vault some_vault

The end result was exactly the same. The "notes" field value visualizes ok in the UI, unfortunately this is not the case with a text field.

Executing the command straight up like this is also something that does not bring the result we expect:

op item create --vault some_vault --category Database 'type=MySQL' 'title=test_user/testing' "multiple_lines[text]='line1\nline2\nline3'" 'port=4234234' 'username=test_user' 'password=asd'

1Password Version: 2.26.1
Extension Version: Not Provided
OS Version: Ubuntu Linux
Browser: Not Provided

Comments

  • Hello @varbarian! 👋

    Thank you for the detailed report! I've been able to reproduce the same issue here on my end and an internal work item already exists to look into this further.

    I've added both your comment and my findings to the internal work item. Hopefully this is something that can be improved in a future update.

    Let me know if there's anything else that I can help you with.

    -Dave

    ref: dev/core/core#17444

This discussion has been closed.