Skip to content

Chinese characters, a null pointer error will occur. #515

@leptobo

Description

@leptobo

Description

func Open (filename string )(*Document ,error ){_gegb ,_efgb :=_ed .Open (filename );if _efgb !=nil {return nil ,_be .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_efgb );};defer _gegb .Close ();
_faec ,_efgb :=_ed .Stat (filename );if _efgb !=nil {return nil ,_be .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,efgb );}; =_faec ;return Read (_gegb ,_faec .Size ());};

When using this method, if the file path (filename) contains Chinese characters, a null pointer error will occur.

Expected Behavior

实际行为

func Open (filename string )(*Document ,error ){_gegb ,_efgb :=_ed .Open (filename );if _efgb !=nil {return nil ,_be .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_efgb );};defer _gegb .Close ();
_faec ,_efgb :=_ed .Stat (filename );if _efgb !=nil {return nil ,_be .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,efgb );}; =_faec ;return Read (_gegb ,_faec .Size ());};

Please include a reproducible code snippet or document attachment that
demonstrates the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions