Skip to content

Error when creating notes with free url #420

@sunbit

Description

@sunbit

Having allowfreeurl set to true, an error raises:

2017-04-11T10:51:43.884Z - error:  TypeError: Cannot read property 'length' of undefined
at Model.<anonymous> (/private/var/projects/hackmd/hackmd/lib/models/revision.js:242:35) 

It seems that it's trying to create a revision, but as the note still doesn't have content, it fails when accessing content properties. I patched lies 240:241 with

lastContent: note.content ? note.content : '',
length: note.content ? note.content.length : 0,

It works for me, but i suspect it would be better that the note have a default empty content?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions