mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-08 00:22:14 +01:00
fix(chromium): hypen-data now work everytime
This commit is contained in:
@@ -273,12 +273,17 @@ RUN \
|
|||||||
# https://github.com/arachnys/athenapdf/commit/ba25a8d80a25d08d58865519c4cd8756dc9a336d.
|
# https://github.com/arachnys/athenapdf/commit/ba25a8d80a25d08d58865519c4cd8756dc9a336d.
|
||||||
COPY build/fonts.conf /etc/fonts/conf.d/100-gotenberg.conf
|
COPY build/fonts.conf /etc/fonts/conf.d/100-gotenberg.conf
|
||||||
|
|
||||||
|
# Copy dictionnaries so that hypens work on Chromium.
|
||||||
|
# See https://github.com/gotenberg/gotenberg/issues/1293.
|
||||||
|
COPY --chown=gotenberg:gotenberg build/chromium-hyphen-data /home/gotenberg/chromium-hyphen-data
|
||||||
|
|
||||||
# Copy the Golang binaries.
|
# Copy the Golang binaries.
|
||||||
COPY --from=compress-go-binaries-stage /home/pdfcpu /usr/bin/
|
COPY --from=compress-go-binaries-stage /home/pdfcpu /usr/bin/
|
||||||
COPY --from=compress-go-binaries-stage /home/gotenberg /usr/bin/
|
COPY --from=compress-go-binaries-stage /home/gotenberg /usr/bin/
|
||||||
|
|
||||||
# Environment variables required by modules or else.
|
# Environment variables required by modules or else.
|
||||||
ENV CHROMIUM_BIN_PATH=/usr/bin/chromium
|
ENV CHROMIUM_BIN_PATH=/usr/bin/chromium
|
||||||
|
ENV CHROMIUM_HYPHEN_DATA_DIR_PATH=/home/gotenberg/chromium-hyphen-data
|
||||||
ENV LIBREOFFICE_BIN_PATH=/usr/lib/libreoffice/program/soffice.bin
|
ENV LIBREOFFICE_BIN_PATH=/usr/lib/libreoffice/program/soffice.bin
|
||||||
ENV UNOCONVERTER_BIN_PATH=/usr/bin/unoconverter
|
ENV UNOCONVERTER_BIN_PATH=/usr/bin/unoconverter
|
||||||
ENV PDFTK_BIN_PATH=/usr/bin/pdftk
|
ENV PDFTK_BIN_PATH=/usr/bin/pdftk
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-af.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-af.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-as.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-as.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-be.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-be.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-bg.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-bg.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-bn.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-bn.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-cs.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-cs.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-cu.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-cu.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-cy.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-cy.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-da.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-da.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-de-1901.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-de-1901.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-de-1996.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-de-1996.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-de-ch-1901.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-de-ch-1901.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-el.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-el.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-en-gb.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-en-gb.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-en-us.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-en-us.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-es.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-es.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-et.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-et.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-eu.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-eu.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-fr.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-fr.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-ga.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-ga.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-gl.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-gl.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-gu.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-gu.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-hi.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-hi.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-hr.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-hr.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-hu.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-hu.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-hy.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-hy.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-it.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-it.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-ka.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-ka.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-kn.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-kn.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-la.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-la.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-lt.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-lt.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-lv.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-lv.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-ml.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-ml.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-mn-cyrl.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-mn-cyrl.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-mr.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-mr.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-mul-ethi.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-mul-ethi.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-nb.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-nb.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-nl.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-nl.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-nn.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-nn.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-or.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-or.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-pa.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-pa.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-pt.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-pt.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-ru.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-ru.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-sk.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-sk.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-sl.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-sl.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-sq.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-sq.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-sv.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-sv.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-ta.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-ta.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-te.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-te.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-tk.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-tk.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-uk.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-uk.hyb
Normal file
Binary file not shown.
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-und-ethi.hyb
Normal file
BIN
build/chromium-hyphen-data/120.0.6050.0/hyph-und-ethi.hyb
Normal file
Binary file not shown.
5
build/chromium-hyphen-data/120.0.6050.0/manifest.json
Normal file
5
build/chromium-hyphen-data/120.0.6050.0/manifest.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"manifest_version": 2,
|
||||||
|
"name": "hyphens-data",
|
||||||
|
"version": "120.0.6050.0"
|
||||||
|
}
|
||||||
@@ -39,6 +39,7 @@ type browserArguments struct {
|
|||||||
hostResolverRules string
|
hostResolverRules string
|
||||||
proxyServer string
|
proxyServer string
|
||||||
wsUrlReadTimeout time.Duration
|
wsUrlReadTimeout time.Duration
|
||||||
|
hyphenDataDirPath string
|
||||||
|
|
||||||
// Tasks specific.
|
// Tasks specific.
|
||||||
allowList *regexp2.Regexp
|
allowList *regexp2.Regexp
|
||||||
@@ -79,6 +80,16 @@ func (b *chromiumBrowser) Start(logger *zap.Logger) error {
|
|||||||
debug := &debugLogger{logger: logger}
|
debug := &debugLogger{logger: logger}
|
||||||
b.userProfileDirPath = b.fs.NewDirPath()
|
b.userProfileDirPath = b.fs.NewDirPath()
|
||||||
|
|
||||||
|
// See https://github.com/gotenberg/gotenberg/issues/1293.
|
||||||
|
err := os.MkdirAll(b.userProfileDirPath, 0o755)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("could not create user profile directory: %w", err)
|
||||||
|
}
|
||||||
|
err = os.Symlink(b.arguments.hyphenDataDirPath, fmt.Sprintf("%s/hyphen-data", b.userProfileDirPath))
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("create symlink to hyphen-data directory: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
opts := append(chromedp.DefaultExecAllocatorOptions[:],
|
opts := append(chromedp.DefaultExecAllocatorOptions[:],
|
||||||
chromedp.CombinedOutput(debug),
|
chromedp.CombinedOutput(debug),
|
||||||
chromedp.ExecPath(b.arguments.binPath),
|
chromedp.ExecPath(b.arguments.binPath),
|
||||||
@@ -93,6 +104,8 @@ func (b *chromiumBrowser) Start(logger *zap.Logger) error {
|
|||||||
// See https://github.com/gotenberg/gotenberg/issues/1177.
|
// See https://github.com/gotenberg/gotenberg/issues/1177.
|
||||||
chromedp.Flag("no-zygote", true),
|
chromedp.Flag("no-zygote", true),
|
||||||
chromedp.Flag("disable-dev-shm-usage", true),
|
chromedp.Flag("disable-dev-shm-usage", true),
|
||||||
|
// See https://github.com/gotenberg/gotenberg/issues/1293.
|
||||||
|
chromedp.Flag("disable-component-update", false),
|
||||||
)
|
)
|
||||||
|
|
||||||
if b.arguments.incognito {
|
if b.arguments.incognito {
|
||||||
@@ -133,7 +146,7 @@ func (b *chromiumBrowser) Start(logger *zap.Logger) error {
|
|||||||
allocatorCtx, allocatorCancel := chromedp.NewExecAllocator(b.initialCtx, opts...)
|
allocatorCtx, allocatorCancel := chromedp.NewExecAllocator(b.initialCtx, opts...)
|
||||||
ctx, cancel := chromedp.NewContext(allocatorCtx, chromedp.WithDebugf(debug.Printf))
|
ctx, cancel := chromedp.NewContext(allocatorCtx, chromedp.WithDebugf(debug.Printf))
|
||||||
|
|
||||||
err := chromedp.Run(ctx)
|
err = chromedp.Run(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cancel()
|
cancel()
|
||||||
allocatorCancel()
|
allocatorCancel()
|
||||||
|
|||||||
@@ -395,6 +395,11 @@ func (mod *Chromium) Provision(ctx *gotenberg.Context) error {
|
|||||||
return errors.New("CHROMIUM_BIN_PATH environment variable is not set")
|
return errors.New("CHROMIUM_BIN_PATH environment variable is not set")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hyphenDataDirPath, ok := os.LookupEnv("CHROMIUM_HYPHEN_DATA_DIR_PATH")
|
||||||
|
if !ok {
|
||||||
|
return errors.New("CHROMIUM_HYPHEN_DATA_DIR_PATH environment variable is not set")
|
||||||
|
}
|
||||||
|
|
||||||
mod.args = browserArguments{
|
mod.args = browserArguments{
|
||||||
binPath: binPath,
|
binPath: binPath,
|
||||||
incognito: flags.MustBool("chromium-incognito"),
|
incognito: flags.MustBool("chromium-incognito"),
|
||||||
@@ -405,6 +410,7 @@ func (mod *Chromium) Provision(ctx *gotenberg.Context) error {
|
|||||||
hostResolverRules: flags.MustString("chromium-host-resolver-rules"),
|
hostResolverRules: flags.MustString("chromium-host-resolver-rules"),
|
||||||
proxyServer: flags.MustString("chromium-proxy-server"),
|
proxyServer: flags.MustString("chromium-proxy-server"),
|
||||||
wsUrlReadTimeout: flags.MustDuration("chromium-start-timeout"),
|
wsUrlReadTimeout: flags.MustDuration("chromium-start-timeout"),
|
||||||
|
hyphenDataDirPath: hyphenDataDirPath,
|
||||||
|
|
||||||
allowList: flags.MustRegexp("chromium-allow-list"),
|
allowList: flags.MustRegexp("chromium-allow-list"),
|
||||||
denyList: flags.MustRegexp("chromium-deny-list"),
|
denyList: flags.MustRegexp("chromium-deny-list"),
|
||||||
@@ -449,6 +455,11 @@ func (mod *Chromium) Validate() error {
|
|||||||
return fmt.Errorf("chromium binary path does not exist: %w", err)
|
return fmt.Errorf("chromium binary path does not exist: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, err = os.Stat(mod.args.hyphenDataDirPath)
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return fmt.Errorf("chromium hyphen-data directory path does not exist: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user