unidoc/unipdf

[BUG] "Required" FieldFlag prints as "ReadOnly"

zacharysyoung opened this issue · 2 comments

Description

The String() method on FieldFlag has the word "ReadOnly" duplicated in its output, and it's missing the text "Required".

Consider running the following code in the UniDoc playground:

package main

import (
	"fmt"

	"github.com/unidoc/unipdf/v3/model"
)

func main() {
	var fflags model.FieldFlag
	fflags = fflags.Set(model.FieldFlagReadOnly)
	fflags = fflags.Set(model.FieldFlagRequired)
	fmt.Printf(" Flags: %s (%d)\n", fflags, fflags)
}

Expected Behavior

Flags: ReadOnly|Required (3)

Actual Behavior

Flags: ReadOnly|ReadOnly (3)

In the obfuscated code, I can see that the unicode-literal "ReadOnly" ("\u007cR\u0065\u0061\u0064\u004f\u006e\u006cy") is appended twice:

if _cafgf &FieldFlagReadOnly > 0{_edda +="\u007cR\u0065\u0061\u0064\u004f\u006e\u006cy";};if _cafgf &FieldFlagRequired > 0{_edda +="\u007cR\u0065\u0061\u0064\u004f\u006e\u006cy";

Welcome! Thanks for posting your first issue. The way things work here is that while customer issues are prioritized, other issues go into our backlog where they are assessed and fitted into the roadmap when suitable. If you need to get this done, consider buying a license which also enables you to use it in your commercial products. More information can be found on https://unidoc.io/

Hi @zacharysyoung,

Thank you for reporting this issue, we made a release to fix this issue.
v3.35.0 https://github.com/unidoc/unipdf-src/releases/tag/v3.35.0