add thredname to jul

:grey_exclamation: Build Aborted

The PR is not allowed to run in the CI yet

Expand to view the summary

Build stats

Build Cause: [Pull request #85 opened]

Reason: The PR is not allowed to run in the CI yet

Start Time: 2020-07-31T15:31:34.181+0000

Duration: 3 min 7 sec

Commit: 0e9c4d3d69b7052a25547eaf2e14e3f49ba34a15

Steps errors
Expand to view the steps failures

Name: Load a resource file from a shared library

Description:

Duration: 0 min 0 sec

Start Time: 2020-07-31T15:34:36.843+0000

log

Name: Error signal

Description: githubPrCheckApproved: The PR is not allowed to run in the CI yet. (Only users with write permission

Duration: 0 min 0 sec

Start Time: 2020-07-31T15:34:36.907+0000

log

Log output
Expand to view the last 100 lines of log output

[2020-07-31T15:31:55.591Z] using GIT_SSH to set credentials GitHub user @elasticmachine SSH key
[2020-07-31T15:31:55.598Z]  > git merge 5ee6df16e990567351d3a362f581d7139df330f4 # timeout=10
[2020-07-31T15:31:55.606Z]  > git rev-parse HEAD^{commit} # timeout=10
[2020-07-31T15:31:55.613Z] Merge succeeded, producing 0e9c4d3d69b7052a25547eaf2e14e3f49ba34a15
[2020-07-31T15:31:55.613Z] Checking out Revision 0e9c4d3d69b7052a25547eaf2e14e3f49ba34a15 (PR-85)
[2020-07-31T15:31:55.613Z]  > git config core.sparsecheckout # timeout=10
[2020-07-31T15:31:55.619Z]  > git checkout -f 0e9c4d3d69b7052a25547eaf2e14e3f49ba34a15 # timeout=15
[2020-07-31T15:31:55.636Z] Commit message: "add thredname to jul"
[2020-07-31T15:31:55.636Z] First time build. Skipping changelog.
[2020-07-31T15:31:55.636Z] Cleaning workspace
[2020-07-31T15:31:55.636Z]  > git rev-parse --verify HEAD # timeout=10
[2020-07-31T15:31:55.642Z] Resetting working tree
[2020-07-31T15:31:55.643Z]  > git reset --hard # timeout=10
[2020-07-31T15:31:55.656Z]  > git clean -fdx # timeout=10
[2020-07-31T15:31:55.664Z]  > git --version # timeout=10
[2020-07-31T15:31:55.675Z] fatal: bad object 6c62d3f53b77d98a3e133635021db7fb14d4c2b2
[2020-07-31T15:31:56.473Z] Masking supported pattern matches of $JOB_GCS_BUCKET or $NOTIFY_TO
[2020-07-31T15:31:56.555Z] Timeout set to expire in 1 hr 0 min
[2020-07-31T15:31:56.584Z] The timestamps step is unnecessary when timestamps are enabled for all Pipeline builds.
[2020-07-31T15:32:11.722Z] Still waiting to schedule task
[2020-07-31T15:32:11.722Z] There are no nodes with the label ‘linux&&immutable’
[2020-07-31T15:34:12.511Z] Running on apm-ci-immutable-ubuntu-1804-1596209520079283489 in /var/lib/jenkins/workspace/_java_ecs-logging-java-mbp_PR-85
[2020-07-31T15:34:13.101Z] [INFO] 'shallow' is forced to be disabled when running on PullRequests
[2020-07-31T15:34:13.128Z] Running in /var/lib/jenkins/workspace/_java_ecs-logging-java-mbp_PR-85/src/github.com/elastic/ecs-logging-java
[2020-07-31T15:34:13.173Z] [INFO] gitCheckout: Checkout SCM PR-85 with default customisation from the Item.
[2020-07-31T15:34:13.208Z] [INFO] Override default checkout
[2020-07-31T15:34:13.275Z] Sleeping for 10 sec
[2020-07-31T15:34:25.772Z] using credential f6c7695a-671e-4f4f-a331-acdce44ff9ba
[2020-07-31T15:34:25.793Z] Wiping out workspace first.
[2020-07-31T15:34:25.814Z] Cloning the remote Git repository
[2020-07-31T15:34:25.814Z] Using shallow clone with depth 3
[2020-07-31T15:34:25.814Z] Avoid fetching tags
[2020-07-31T15:34:25.850Z] Cloning repository git@github.com:elastic/ecs-logging-java.git
[2020-07-31T15:34:25.933Z]  > git init /var/lib/jenkins/workspace/_java_ecs-logging-java-mbp_PR-85/src/github.com/elastic/ecs-logging-java # timeout=10
[2020-07-31T15:34:25.997Z] Fetching upstream changes from git@github.com:elastic/ecs-logging-java.git
[2020-07-31T15:34:25.997Z]  > git --version # timeout=10
[2020-07-31T15:34:26.019Z] using GIT_SSH to set credentials GitHub user @elasticmachine SSH key
[2020-07-31T15:34:26.054Z]  > git fetch --no-tags --progress -- git@github.com:elastic/ecs-logging-java.git +refs/heads/*:refs/remotes/origin/* # timeout=15
[2020-07-31T15:34:26.729Z]  > git config remote.origin.url git@github.com:elastic/ecs-logging-java.git # timeout=10
[2020-07-31T15:34:26.764Z] Cleaning workspace
[2020-07-31T15:34:26.790Z] Using shallow fetch with depth 3
[2020-07-31T15:34:26.790Z] Pruning obsolete local branches
[2020-07-31T15:34:27.371Z] Merging remotes/origin/master commit 5ee6df16e990567351d3a362f581d7139df330f4 into PR head commit 0e9c4d3d69b7052a25547eaf2e14e3f49ba34a15
[2020-07-31T15:34:27.524Z] Merge succeeded, producing 0e9c4d3d69b7052a25547eaf2e14e3f49ba34a15
[2020-07-31T15:34:27.525Z] Checking out Revision 0e9c4d3d69b7052a25547eaf2e14e3f49ba34a15 (PR-85)
[2020-07-31T15:34:26.742Z]  > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
[2020-07-31T15:34:26.753Z]  > git config remote.origin.url git@github.com:elastic/ecs-logging-java.git # timeout=10
[2020-07-31T15:34:26.763Z]  > git rev-parse --verify HEAD # timeout=10
[2020-07-31T15:34:26.775Z] No valid HEAD. Skipping the resetting
[2020-07-31T15:34:26.775Z]  > git clean -fdx # timeout=10
[2020-07-31T15:34:26.792Z] Fetching upstream changes from git@github.com:elastic/ecs-logging-java.git
[2020-07-31T15:34:26.792Z] using GIT_SSH to set credentials GitHub user @elasticmachine SSH key
[2020-07-31T15:34:26.798Z]  > git fetch --no-tags --progress --prune -- git@github.com:elastic/ecs-logging-java.git +refs/pull/85/head:refs/remotes/origin/PR-85 +refs/heads/master:refs/remotes/origin/master # timeout=15
[2020-07-31T15:34:27.377Z]  > git config core.sparsecheckout # timeout=10
[2020-07-31T15:34:27.383Z]  > git checkout -f 0e9c4d3d69b7052a25547eaf2e14e3f49ba34a15 # timeout=15
[2020-07-31T15:34:27.421Z]  > git remote # timeout=10
[2020-07-31T15:34:27.440Z]  > git config --get remote.origin.url # timeout=10
[2020-07-31T15:34:27.456Z] using GIT_SSH to set credentials GitHub user @elasticmachine SSH key
[2020-07-31T15:34:27.467Z]  > git merge 5ee6df16e990567351d3a362f581d7139df330f4 # timeout=10
[2020-07-31T15:34:27.500Z]  > git rev-parse HEAD^{commit} # timeout=10
[2020-07-31T15:34:27.525Z]  > git config core.sparsecheckout # timeout=10
[2020-07-31T15:34:27.552Z]  > git checkout -f 0e9c4d3d69b7052a25547eaf2e14e3f49ba34a15 # timeout=15
[2020-07-31T15:34:31.262Z] Commit message: "add thredname to jul"
[2020-07-31T15:34:31.262Z] Cleaning workspace
[2020-07-31T15:34:31.349Z]  > git --version # timeout=10
[2020-07-31T15:34:31.370Z] fatal: bad object 6c62d3f53b77d98a3e133635021db7fb14d4c2b2
[2020-07-31T15:34:31.262Z]  > git rev-parse --verify HEAD # timeout=10
[2020-07-31T15:34:31.277Z] Resetting working tree
[2020-07-31T15:34:31.278Z]  > git reset --hard # timeout=10
[2020-07-31T15:34:31.294Z]  > git clean -fdx # timeout=10
[2020-07-31T15:34:32.563Z] Masking supported pattern matches of $GIT_USERNAME or $GIT_PASSWORD
[2020-07-31T15:34:33.197Z] + git fetch<EMAIL_ADDRESS>+refs/pull/*/head:refs/remotes/origin/pr/*
[2020-07-31T15:34:33.521Z] Archiving artifacts
[2020-07-31T15:34:34.224Z] + git rev-parse HEAD
[2020-07-31T15:34:34.604Z] + git rev-parse HEAD
[2020-07-31T15:34:34.930Z] + git rev-parse origin/pr/85
[2020-07-31T15:34:34.985Z] [INFO] githubEnv: Found Git Build Cause: pr
[2020-07-31T15:34:35.494Z] Masking supported pattern matches of $GITHUB_TOKEN
[2020-07-31T15:34:36.500Z] [WARN] githubApiCall: The REST API call https://api.github.com/repos/elastic/ecs-logging-java/pulls/85/reviews return 0 elements
[2020-07-31T15:34:36.566Z] [INFO] githubPrCheckApproved: Title: add thredname to jul - User: pantovad - Author Association: FIRST_TIME_CONTRIBUTOR
[2020-07-31T15:34:36.927Z] ERROR: githubPrCheckApproved: The PR is not allowed to run in the CI yet
[2020-07-31T15:34:36.927Z] ERROR: githubPrCheckApproved: The PR is not allowed to run in the CI yet. (Only users with write permissions can do so.)
[2020-07-31T15:34:37.019Z] [INFO] Let's stop build #1. The PR is not allowed to run in the CI yet
[2020-07-31T15:34:37.043Z] Sleeping for 5 sec
[2020-07-31T15:34:38.186Z] Stage "Build" skipped due to earlier failure(s)
[2020-07-31T15:34:38.436Z] Stage "Tests" skipped due to earlier failure(s)
[2020-07-31T15:34:38.574Z] Stage "Unit Tests" skipped due to earlier failure(s)
[2020-07-31T15:34:38.588Z] Stage "Javadoc" skipped due to earlier failure(s)
[2020-07-31T15:34:38.601Z] Stage "Sanity checks" skipped due to earlier failure(s)
[2020-07-31T15:34:38.708Z] Failed in branch Unit Tests
[2020-07-31T15:34:38.718Z] Failed in branch Javadoc
[2020-07-31T15:34:38.728Z] Failed in branch Sanity checks
[2020-07-31T15:34:40.168Z] Running on worker-1095690 in /var/lib/jenkins/workspace/_java_ecs-logging-java-mbp_PR-85
[2020-07-31T15:34:40.470Z] [INFO] getVaultSecret: Getting secrets
[2020-07-31T15:34:40.547Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-07-31T15:34:42.694Z] + chmod 755 generate-build-data.sh
[2020-07-31T15:34:42.695Z] + ./generate-build-data.sh https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-java/ecs-logging-java-mbp/PR-85/ https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-java/ecs-logging-java-mbp/PR-85/runs/1 ABORTED 187085
[2020-07-31T15:34:42.695Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-java/ecs-logging-java-mbp/PR-85/runs/1/steps/?limit=10000 -o steps-info.json
[2020-07-31T15:34:45.844Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-java/ecs-logging-java-mbp/PR-85/runs/1/tests/?status=FAILED -o tests-errors.json
[2020-07-31T15:34:46.546Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-java/ecs-logging-java-mbp/PR-85/runs/1/log/ -o pipeline-log.txt

As mentioned in #84 this does not work with async appenders

That sounds like a very good idea!

superseded by #104


[Feature Request] Add Ability To Generate C# Project For Projects Not Using Templates

Before the new templates update, USharp would automatically add a Managed Folder to your project when you had the plugin enabled. Now it seems like the plugin is enabled by default, and 2 new C# starter templates have been added. But for those who want to add C# Code to an existing project (that hasn't been added to yet), it'll be a big hassle for them. I'd suggest creating a USharp command that'll generate all the needed files and put them into a Managed folder, just like before. This will make life a lot easier for those who want to add USharp to an existing project.

I agree

What do you think would be better:

Enable USharp in the project settings (editor restart is required), when loading USharp detects that the C# sln file doesn't exist. It prompts a dialog to generate it (this prompt will be shown any time it fails to detect the C# sln file).

Enable USharp in the project settings (editor restart is required), a command USharpGen project must be typed into the UE4 command box to generate the C# sln file.

The first one is better for users. However the second point is fine too.

I think the first option would be the best. Hopefully that means USharp will still be installed by default, so that C# templates will show up in the new project window. The second option is what I was originally thinking.

Implemented in https://github.com/pixeltris/USharp/commit/ea5ec40afc35606d145b5429eec09bc9b054aa7b. It prompt to copy from the TP_Blank template if no C# game code exists and USharp is enabled (this prompt will be shown when your project is loaded, after you enable USharp in your project settings).

Has this been implemented? I'm finding that when I enable USharp and restart the editor, I'm not prompted to generate C# code, despite the plugin appearing enabled. In addition, the console commands don't allow me to generate any code either.

The plugin itself is set to always be enabled. There is an additional checkbox under your project settings to enable USharp on an existing non C# project, see https://github.com/pixeltris/USharp/wiki/Plugin-Setup#adding-c-to-an-existing-project

Thanks - that's what I tried however it's not working. The steps I'm doing are the following:

Create New Basic Code C++ Project
USharp comes in enabled on the project by default
No USharp console commands are available
So I untick enabled and restart UE4 (as UE4 prompts)
No USharp console commands are available (as expected)
So tick enabled and restart UE4 (as UE4 prompts)
No USharp console commands are available (not expected)

It sounds like you're using the plugin checkbox. There should be a separate checbox in "Edit->Project Settings...". The USharp commands are only available when you enable the checkbox in that section.

Apologies - yes I was.  I should have read your very clear instructions on this rather than skimmed and assumed you were simply referring to enabling the plugin from the plugins menu. It's now working fine.


Support SIGINT signal.

This fixes #175 .
Added context.WithCancel and passed it to app.RunContext(ctx, os.Args).

Codecov Report

Merging #271 into master will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #271   +/-   ##
=======================================
  Coverage   61.32%   61.32%
=======================================
  Files          68       68
  Lines        6345     6345
=======================================
  Hits         3891     3891
  Misses       1938     1938
  Partials      516      516

Impacted Files
Coverage Δ

sql/query/reindex.go
81.81% <ø> (ø)

database/config.go
68.59% <100.00%> (ø)

sql/parser/expr.go
77.81% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 375ed7a...04c21fa. Read the comment docs.

it's ok for me. It was one of my interrogation ! should we close the db and exit.  I look forward your PR. ;)

@tzzed @asdine I’ve left a few review comments even though look like this won’t get merged 🤗
Should we close this PR for now?

Yes let's close it 👍🏼


*: use autogen DeepCopy() to replace our own

LGTM. e2e flake seems unrelated.

Known issue about network in etcd bootstrap:
etcdserver: could not get cluster response from http://test-etcd-h8q6z-0000.test-etcd-h8q6z.e2e-etcd-operator-2327.svc:2380: Get http://test-etcd-h8q6z-0000.test-etcd-h8q6z.e2e-etcd-operator-2327.svc:2380/members: dial tcp <IP_ADDRESS>:2380: i/o timeout


ENHANCEMENT: Add golint as workflow job

In order to improve the code quality of gomerge, we should implement a number of automated code quality checks.
This issue related specifically to golint. This should be implemented as a job in the https://github.com/Cian911/gomerge/blob/master/.github/workflows/test.yml workflow file. This should run before the main test suite and should fail the entire workflow if a change fails.

I'd like to do this ^^

Done in https://github.com/Cian911/gomerge/pull/59


I don't seem to have this file

6598 error path E:\useAtomicAssets-main\cryptopuppie-useatomicassets-0.0.1.tgz
6599 error errno -4058
6600 error enoent ENOENT: no such file or directory, open 'E:\useAtomicAssets-main\cryptopuppie-useatomicassets-0.0.1.tgz'

6598 error path E:\useAtomicAssets-main\cryptopuppie-useatomicassets-0.0.1.tgz 6599 error errno -4058 6600 error enoent ENOENT: no such file or directory, open 'E:\useAtomicAssets-main\cryptopuppie-useatomicassets-0.0.1.tgz'

Sorry, since I haven't published it yet, I have been manually installing it first. You can follow bellow if you want to test the example.
You to pack it first and install it to the example.
npm pack

Then install from the example folder.
npm install ../cryptopuppie-useatomicassets-0.0.1.tgz

6598 错误路径 E:\useAtomicAssets-main\cryptopuppie-useatomicassets-0.0.1.tgz 6599 错误 errno -4058 6600 错误 enoent ENOENT：没有这样的文件或目录，打开 'E:\useAtomicAssets-main\cryptopuppie-useatomicassets-0.0。 1.tgz'

抱歉，由于我还没有发布它，我一直在手动安装它。如果你想测试这个例子，你可以按照下面的操作。
您先将其打包并将其安装到示例中。
npm pack

然后从示例文件夹安装。
npm install ../cryptopuppie-useatomicassets-0.0.1.tgz

ok  I'll try

When I try to run NPM start
Failed to compile.
./src/App.tsx
Module not found: Can't resolve '@cryptopuppie/useatomicassets' in 'E:\useAtomicAssets\example\src'

{
"name": "example",
"version": "0.1.0",
"private": true,
"dependencies": {
"@cryptopuppie/useatomicassets": "file:./example-0.1.0.tgz",

When I try to run NPM start
Failed to compile. ./src/App.tsx Module not found: Can't resolve '@cryptopuppie/useatomicassets' in 'E:\useAtomicAssets\example\src'

You need to run the npm pack on the root folder not on example. Then, you can install it with npm install ../cryptopuppie-useatomicassets-0.0.1.tgz.

I have published this library. You can now try to install it.
npm install @cryptopuppie/useatomicassets --save


It's not possible to know was changeset inserted or not on Upsert

Environment

Elixir version (elixir -v): 1.7.2
Database and version (PostgreSQL 9.4, MongoDB 3.2, etc.): PostgreSQL 10
Ecto version (mix deps): master, commit bba34c5ba218537bf196630179e4934946ab94e0
Database adapter and version (mix deps): 6cabc3b018cabc6e036e7d162414889a20785b96
Operating system: MacOS

Current behavior
Quote from Ecto.Repo docs:

Now we can insert with the same title but do nothing on conflicts:
{:ok, ignored} = MyRepo.insert(%Post{title: "this is unique"}, on_conflict: :nothing)

assert ignored.id == nil

This way of determining was something inserted or not only works when you use structs, but it fails with changesets, here is pseudo-code:
post = Post.changeset(%{"title" => "this is unique"})
{:ok, ignored} = MyRepo.insert(post, on_conflict: :nothing, returning: true)
assert ignored.id == # it's not nil any more, but a randomly generated UUID

I believe it’s because ID is generated when we turn changeset into schema right before inserting it, not sure why Ecto does not read the ID back though.
(My specific use case is inserting changeset via Ecto.Multi.insert, but it should not be relevant. Primary keys are set to :binary_id, autogenerate: true.)
Expected behavior
A way to determine was changeset inserted or not.
cc @wojtekmach

In cases like that we simply can't know because the database does not return us any information. So you need to have at least some field with read_after_writes set to true or let the database generate the UUID for you. You can also perform a separate read  but there is nothing "built-in".

Thank you, got it. As a workaround for people came from Google I'm removing on_conflict from insert/2 and adding a unique constraint to the changeset. So I can read back inserted struct only when conflict occurred and proceed with loaded data.

@josevalim just to confirm, returning: true also doesn't help there? I thought it should read all the fields back? Similar to having read_after_writes set on all the fields.

@josevalim should not just override all fields in the returned schema? I'm not sure how to define the diff there because I do not get two copies of the data.

should not just override all fields in the returned schema?

It should.
But if you want to know exactly what happened, then you need a before (before you call insert) and an after (the returned value) and at least one value that is guaranteed to change (it could be inserted_at).

It should.

So in real life it does not, then I guess it is a real bug?

I don't think the database will return anything in case of a failed insert. So you can check that by verifying that the created_at column didn't change.


Remove statement that bool dtype must be stored as a byte

Closes gh-86

Trivial fix, and useful for exercising the new GH Action - so merging.


NativeEnv evals constants twice

Rendering in native mode performs literal_eval twice on constant values, which leads to unexpected behaviour.
Expected Behavior
>>> NativeEnvironment().from_string(r'''0.000{{ a }}''').render({"a":7})
0.0007
>>> NativeEnvironment().from_string(r'''0.000{{ 7 }}''').render({"a":7})
0.0007

Templates should behave the same way with constants as they do with dynamic variables.
Nothing should be eval'd before the entire template is finished.
Actual Behavior
>>> NativeEnvironment().from_string(r'''0.000{{ a }}''').render({"a":7})
0.07
>>> NativeEnvironment().from_string(r'''0.000{{ 7 }}''').render({"a":7})
0.0007
>>> NativeEnvironment().from_string(r'''{{b}}{{ a }}''').render({"a":7,"b":"0.000"})
0.0007

In the first case the constant 0.000 gets eval'd at template compile time, and truncated to 0.0 before the entire template has been rendered with dynamic data. The template gets eval'd a second time at render time, meaning the constant value has been double eval'd.
In the second case the whole template is constant, and gets eval'd in one go at compile time producing different results.
In the third case the whole template is dynamic, and gets eval'd in one go at render time.
Your Environment

Python version: 3.7.6
Jinja version: 2.11.1

Suggested solution
_output_const_repr() should not perform any evals, only render() should perform one eval at the very end. This seems to me like the only sane way to prevent weird double-eval issues like this one.
The preserve_quotes workaround in native_concat would no longer be needed with this change. It appears to have been a previous attempt at fixing this class of problems.
Fixing it this way would also fix the same problem in the underlying root_render_func api:
>>> t = NativeEnvironment().from_string(r'''{{ a }}''')
>>> list(t.root_render_func(t.new_context({"a":"7"})))
['7']
>>> t = NativeEnvironment().from_string(r'''{{"7"}}''')
>>> list(t.root_render_func(t.new_context({"a":"7"})))
[7]

This is very interesting. I have tested the suggested solution [0] (and removing preserve_quotes in addition [1]) and it works and the current test suite passes with the changes. This makes sense to me but I am not able to say if this could break any valid use case.
[0]
diff --git a/src/jinja2/nativetypes.py b/src/jinja2/nativetypes.py
index e0ad94d..4c89998 100644
--- a/src/jinja2/nativetypes.py
+++ b/src/jinja2/nativetypes.py
@@ -61,7 +61,7 @@ class NativeCodeGenerator(CodeGenerator):
         return value

     def _output_const_repr(self, group):
-        return repr(native_concat(group))
+        return repr("".join([str(v) for v in group]))

     def _output_child_to_const(self, node, frame, finalize):
         const = node.as_const(frame.eval_ctx)
diff --git a/tests/test_nativetypes.py b/tests/test_nativetypes.py
index 947168c..9da1b29 100644
--- a/tests/test_nativetypes.py
+++ b/tests/test_nativetypes.py
@@ -136,3 +136,11 @@ def test_concat_strings_with_quotes(env):
 def test_spontaneous_env():
     t = NativeTemplate("{{ true }}")
     assert isinstance(t.environment, NativeEnvironment)
+
+
+def test_1186(env):
+    from math import isclose
+    t = env.from_string("0.000{{ a }}")
+    result = t.render({"a":7})
+    assert isinstance(result, float)
+    assert isclose(result, 0.0007)

[1]
diff --git a/src/jinja2/nativetypes.py b/src/jinja2/nativetypes.py
index 4c89998..bba4f0a 100644
--- a/src/jinja2/nativetypes.py
+++ b/src/jinja2/nativetypes.py
@@ -1,4 +1,3 @@
-import types
 from ast import literal_eval
 from itertools import chain
 from itertools import islice
@@ -10,17 +9,14 @@ from .environment import Environment
 from .environment import Template

-def native_concat(nodes, preserve_quotes=True):
+def native_concat(nodes):
     """Return a native Python type from the list of compiled nodes. If
     the result is a single node, its value is returned. Otherwise, the
     nodes are concatenated as strings. If the result can be parsed with
     :func:`ast.literal_eval`, the parsed value is returned. Otherwise,
     the string is returned.

-    :param nodes: Iterable of nodes to concatenate.
-    :param preserve_quotes: Whether to re-wrap literal strings with
-        quotes, to preserve quotes around expressions for later parsing.
-        Should be ``False`` in :meth:`NativeEnvironment.render`.
+    :param nodes: Generator of nodes to concatenate.
     """
     head = list(islice(nodes, 2))

@@ -30,30 +26,17 @@ def native_concat(nodes, preserve_quotes=True):
     if len(head) == 1:
         raw = head[0]
     else:
-        if isinstance(nodes, types.GeneratorType):
-            nodes = chain(head, nodes)
-        raw = "".join([str(v) for v in nodes])
+        raw = "".join([str(v) for v in chain(head, nodes)])

     try:
-        literal = literal_eval(raw)
+        return literal_eval(raw)
     except (ValueError, SyntaxError, MemoryError):
         return raw

-    # If literal_eval returned a string, re-wrap with the original
-    # quote character to avoid dropping quotes between expression nodes.
-    # Without this, "'{{ a }}', '{{ b }}'" results in "a, b", but should
-    # be ('a', 'b').
-    if preserve_quotes and isinstance(literal, str):
-        quote = raw[0]
-        return f"{quote}{literal}{quote}"
-
-    return literal
-

 class NativeCodeGenerator(CodeGenerator):
     """A code generator which renders Python types by not adding
-    ``str()`` around output nodes, and using :func:`native_concat`
-    to convert complex strings back to Python types if possible.
+    ``str()`` around output nodes.
     """

     @staticmethod
@@ -101,9 +84,7 @@ class NativeTemplate(Template):
         """
         vars = dict(*args, **kwargs)
         try:
-            return native_concat(
-                self.root_render_func(self.new_context(vars)), preserve_quotes=False
-            )
+            return native_concat(self.root_render_func(self.new_context(vars)))
         except Exception:
             return self.environment.handle_exception()

Happy to consider a PR. This feature came from Ansible, so it would be helpful if @jctanner and @mkrizek could continue to review it.
I do remember looking at why intermediate steps were doing literal_eval when working on the preserve_quotes issue, but can't remember what conclusion I reached. At the time I think I left it in place because I figured it might have an effect on how native types flowed through the render.

As a side note, I was originally trying to implement something similar to ansible. The exact thing I was going for was "return the native type if and only if the template had exactly one expression." (I thought I'd to use a native root_render_function, if there is one node return it, otherwise do a normal template concat.)

I created PR #1190 with @mkrizek's patch.
As far as I can tell this doesn't negatively affect anything. Running native_concat on intermediate groups would return a native type, but that would either get concatenated as a string in a subsequent group, or it would be the final node and pass through native_concat anyway.

Just released 2.11.2 with this.

@Qhesz @davidism Thanks!

This change breaks at least some valid ansible scripts:
I have a script with the following loop:
loop: "{{ [ 'dsa', 'rsa', 'ecdsa', 'ed25519' ] | product([ '', '.pub' ]) | list }}"

Which used to works, but now fails with the error:
fatal: FAILED! => {"msg": "Invalid data passed to 'loop', it requires a list, got this instead: [('dsa', ''), ('dsa', '.pub'), ('rsa', ''), ('rsa', '.pub'), ('ecdsa', ''), ('ecdsa', '.pub'), ('ed25519', ''), ('ed25519', '.pub')]. Hint: If you passed a list/dict of just one element, try adding wantlist=True to your lookup invocation or use q/query instead of lookup."}

I think this is cause by the fact that the template engine now returns a string instead of a list to the concat methods.

@Jean-Daniel Thank you for letting us know! I can't reproduce the issue with Jinja2 master branch and Ansible devel branch. I bet it's combination of Ansible and Jinja2 versions that cause your issue. Would you mind filing an issue in ansible/ansible so we can take it and figure it out there? Thanks!

You have to make sure jinja2_native = true is enable in ansible config (which is not the default).
Nonetheless, I'm going try to write a minimal playbook and submit an issue in ansible.


add a copy function in order to copy a file to anywhere of remote

Dear team:
I am co-worker of @zz22394
I add a function to implement the issue #215
can you check it for me ?
If there a problem in source code , I will  write a document about  how to use the new function .
Thank you very much !

Hi Sun, travis caught some style issues when it ran flake8 on the code:
https://s3.amazonaws.com/archive.travis-ci.org/jobs/158417802/log.txt
You should be able to check the style locally by running make precommit
The other travis failures don't look to be related to your change.

@sunjiangjing I've fixed a couple of small issues with precommit and moved script.py to file.py. The functionality you added is now accessible via presto-admin file copy.
Thanks for your contribution!


Drop support for Python 3.6

See repobee/repobee#986

Hey @slarse, would it be okay if I make those changes?

Hi @gauravagrwal !
That would be great. You can go ahead.


length missing in simplified repetition

The 50m and 100m are missing from the repetition JasiMasters2024032401.xml
Have a look at the image to see how exactly the 8x150 are to be swum.

The XSL is breaking because the way this is represented should cause an XSD assertion failure,
You're representing the 150 as a repetition of a 50 and a 100, which isn't a 150.
So either the inside of each 2x repetition should be wrapped in a continue to make them 150s
or these are meant to be broken 150s as there is rest after each stop, something that is not currently achievable using the current xsd and xsl.

Okay, this will become a feature request. I will keep this open until we have the time to fix this. Maybe we need to create a new type of repetition that includes required lengths.

I tried this again with a repetition that only consists of 50 meters:
jasiMasters/JasiMasters2024032601.xml

It should be 16 x 50 meters in the front. The 50 meters inside the brackets should be shown. There seems to be something else wrong here. According to your explanation, this should have worked if all the instructions are of the same length.


Export runListT?

Should runListT be exported? I stumbled on this when going through this:
https://github.com/Gabriel439/Haskell-List-Transformer-Library/blob/master/src/List/Transformer.hs
where runListT is used.
Ok it seems its a different runListT - so it probably shouldn't be exported.

It does seem bizarre that the library defines runListT and then seems to do nothing with it.

It should be removed since ListT has a Newtype instance now.

It should be removed since ListT has a Newtype instance now.

It looks like there is a bug here... ListT's constructor is not exported, nor is Step, the inner type, so I don't think that Newtype instance should be allowed.

Is the correct approach to export just the constructor and remove the Newtype instance? That would be breaking.

We'll be doing some breaking updates soon anyway... but there is a non-breaking solution too: export the stuff that is hidden!
I think I asked @paf31 about it before and he thought that it was better to keep it private though.

At the very least, for consistency with the other transformers, it seems to me that runListT should indeed be exported. I imagine that @paf31 has some good reason for keeping it this way?
As for not exposing the ListT constructor, that makes some sense, as nil, singleton, unfold etc. provide ample ways to enter the monad.

(adding to the above, perhaps what we really want is some modified version of runListT that "unrolls" the monad into a list, strict or lazy, in the parent monad?)

https://hackage.haskell.org/package/list-t-1/docs/ListT.html
For reference, the above package provides such facilities as toList.

I think I asked @paf31 about it before and he thought that it was better to keep it private though.

I think it's probably fine, especially since we have a Newtype instance anyway now. Let's just export the constructor.

In the Gabriel's library  'runListT :: Monad m => ListT m a -> m ()' is described as 'Use this to drain a ListT, running it to completion and discarding all values.  And I think something like this should work:

I think you would need foldl' at least, but there's no reason we couldn't provide that function.


Validating file input

Coming from Yup. I'm trying to validate a required file input with no success:
file: z.any().refine(val => val.length > 0, "File is required")

Any tips?

i guess that you can check if is a instace of File

@wassim is this a File instance? If so just use z.instanceof(File). Though there's no length property on the File class: https://developer.mozilla.org/en-US/docs/Web/API/File

@colinhacks thanks for your answer. I am also looking for a solution. Can i also check if the File MIME-Type is for e.g. an image/*. How can i do that with zod?

I need to validate this, but I don't know how can I match the type using FileList type

You really shouldn't use toZod, it's very fragile and not supported.. It's also totally unnecessary here because you're not trying to define recursive schemas (which is the only scenario where it sorta comes in handy). Just get rid of the : toZod<blahblah> annotations and this will work.

@niklasgrewe File is a built-in class that's only defined on the browser, not in Node.js environments. If you're using a Node.js library to handle file uploads, use the File class provided by that library (it may not be called "File", it depends on the library).
If you're writing code that will run in the browser, you need to tell TypeScript to include browser-specific classes like File. Add "dom" to your "lib" array in tsconfig.json:
{
  "compilerOptions": {
    "lib": [
      "esnext",
      "dom" // <- add this
    ],
    // ... other stuff
  }
}

@niklasgrewe File is a built-in class that's only defined on the browser, not in Node.js environments. If you're using a Node.js library to handle file uploads, use the File class provided by that library (it may not be called "File", it depends on the library).
If you're writing code that will run in the browser, you need to tell TypeScript to include browser-specific classes like File. Add "dom" to your "lib" array in tsconfig.json:
{
  "compilerOptions": {
    "lib": [
      "esnext",
      "dom" // <- add this
    ],
    // ... other stuff
  }
}

I am getting the same error as @AlvaroAquijeDiaz . "dom" is already in the config and it's not working.
FYI: I am currently writing a schema using nextjs and react-hook-forms.
ReferenceError: File is not defined

Any ideas?

@niklasgrewe File is a built-in class that's only defined on the browser, not in Node.js environments. If you're using a Node.js library to handle file uploads, use the File class provided by that library (it may not be called "File", it depends on the library).
If you're writing code that will run in the browser, you need to tell TypeScript to include browser-specific classes like File. Add "dom" to your "lib" array in tsconfig.json:
{
  "compilerOptions": {
    "lib": [
      "esnext",
      "dom" // <- add this
    ],
    // ... other stuff
  }
}

I am getting the same error as @AlvaroAquijeDiaz . "dom" is already in the config and it's not working.
FYI: I am currently writing a schema using nextjs and react-hook-forms.
ReferenceError: File is not defined

I am experiencing the same issue.

Any ideas?

@AlvaroAquijeDiaz  @niklasgrewe @colinhacks  @d4vvv
So I was refactoring and doing some code cleanup on my forms component and I think I accidentally found a temporary solution. I say temporary because it doesn't completely address the problem.
I added z.instanceof(File) into my schema and then put the schema in a separate file ts file.
When I imported it into my forms component, the ReferenceError disappeared. I tried on both Chrome and Firefox and it worked.
See if that works for you.

@CoreyGumbs I'll definitely try this, thanks

@CoreyGumbs Tried your solution but no luck on my end. Moved the schema into its own file like you said but got the same error.  @AlvaroAquijeDiaz Did it work for you?

@HARAJLI98 yep still getting errors, I think we'll just have to use the z. any

@HARAJLI98 @AlvaroAquijeDiaz
Sorry for the late reply, just getting back to my project. So I don't know what I did, or what happened, and wasn't able to reproduce the result, but I too am getting an error when trying this on a new form Im making.
I created an object with the properties from the FILE/FILELIST obj just so I could move forward and test my upload on my form:
upload_files: z.object({     name: z.string({       required_error:         "Please upload a valid file type. (MP3/MP4, JPG, JPEG, PNG)",     }),     lastModified: z.number(),     size: z.number(),     type: z.string(),   }),
this is probably not the best solution but it did get rid of the type of errors I was getting, even with .any()

Putting this here if anyone still has this problem. The solution that worked for me was this one:
`
const MAX_FILE_SIZE = 500000;
const ACCEPTED_IMAGE_TYPES = ["image/jpeg", "image/jpg", "image/png", "image/webp"];
const RegistrationSchema = z.object({
profileImage: z
.any()
.refine((files) => files?.length == 1, "Image is required.")
.refine((files) => files?.[0]?.size <= MAX_FILE_SIZE, Max file size is 5MB.)
.refine(
(files) => ACCEPTED_IMAGE_TYPES.includes(files?.[0]?.type),
".jpg, .jpeg, .png and .webp files are accepted."
),
});
`
No image provided

Too big

Wrong type

All good ✔

@HARAJLI98 yep still getting errors, I think we'll just have to use the z. any

Hey I think this will solve your problem, I'll try it myself and it works
https://github.com/blitz-js/blitz/discussions/2292#discussioncomment-826778

https://gist.github.com/bryantobing12/443f2c417b4ed537284be7cf55bf10ad, this is what works for me

Putting this here if anyone still has this problem. The solution that worked for me was this one:
const MAX_FILE_SIZE = 500000;
const ACCEPTED_IMAGE_TYPES = ["image/jpeg", "image/jpg", "image/png", "image/webp"];

const RegistrationSchema = z.object({
  profileImage: z
    .any()
    .refine((files) => files?.length === 0, "Image is required.") // if no file files?.length === 0, if file files?.length === 1
    .refine((files) => files?.[0]?.size >= MAX_FILE_SIZE, `Max file size is 5MB.`) // this should be greater than or equals (>=) not less that or equals (<=)
    .refine(
      (files) => ACCEPTED_IMAGE_TYPES.includes(files?.[0]?.type),
      ".jpg, .jpeg, .png and .webp files are accepted."
    ),
});

No image provided
Too big   // I will accept this file too so looks for a file bigger that 5MB
Wrong type
All good ✔
Then finally, in the data object we get

Coming from Yup. I'm trying to validate a required file input with no success:
file: z.any().refine(val => val.length > 0, "File is required")

Any tips?

I resolved this in my scenario
identity: zod.any().refine(file => file, "Please upload ID"),

Try val.length === 0

const MAX_FILE_SIZE = 500000;
const ACCEPTED_IMAGE_TYPES = ["image/jpeg", "image/jpg", "image/png", "image/webp"];

const RegistrationSchema = z.object({
  profileImage: z
    .instanceof(FileList) // <--------- here
    .refine((files) => files?.length === 0, "Image is required.")
    .refine((files) => files?.[0]?.size >= MAX_FILE_SIZE, `Max file size is 5MB.`)
    .refine(
      (files) => ACCEPTED_IMAGE_TYPES.includes(files?.[0]?.type),
      ".jpg, .jpeg, .png and .webp files are accepted."
    ),
});

Here in this piece of code i substituted any() for instanceof(FileList) and it  worked smoothly. Its nice to use this because it comes typed properly too.

@officialtbabs Could you please share with us the code where you integrated the form with the schemas defined above ? filetype & filesize validations are getting skipped for me.

zod.any().refine(file => file, "Please upload ID")

This solution worked for me!

To make it more type safe. I do
z.any() as ZodType<File>

Hope you find it useful as well.

UPDATE!! zod recently document the feature for custom schema. (seem like this method already being there for a while)
z.custom<File>()

Just saved me so much time!

To make it more type safe. I do
z.any() as ZodType<File>

Hope you find it useful as well.
UPDATE!! zod recently document the feature for custom schema. (seem like this method already being there for a while)
z.custom<File>()

This will bypass typechecking. To make it typesafe, provide a validation function like this:
z.custom<File>((v) => v instanceof File)

Hey everyone, you can use z.instanceof(File) to validate and make it typesafe at same time. Try:
const schema = z.object({
  file: z.instanceof(File),
})

It will infer the type and ensure that it is instance of File. Check it out ☕🗿

Hey everyone, you can use z.instanceof(File) to validate and make it typesafe at same time. Try:
const schema = z.object({
  file: z.instanceof(File),
})

It will infer the type and ensure that it is instance of File. Check it out ☕🗿

The problem is that Next.js renders its components by a Node.js server, where File class doesn't exists (only available in browsers)

Hey everyone, you can use z.instanceof(File) to validate and make it typesafe at same time. Try:
const schema = z.object({
  file: z.instanceof(File),
})

It will infer the type and ensure that it is instance of File. Check it out ☕🗿

This didn't work for me.

To make it more type safe. I do
z.any() as ZodType<File>

Hope you find it useful as well.
UPDATE!! zod recently document the feature for custom schema. (seem like this method already being there for a while)
z.custom<File>()

This worked.

@officialtbabs
Thanx, it worked flawlessly.

If anyone's using z.instanceof approach and having a hard time giving a custom error message to the validation. This approach worked for me.
const ACCEPTED_FILE_TYPES = ['application/json']

z.custom<File>(val => val instanceof File, 'Please upload a file')
  .refine(
     file => ACCEPTED_FILE_TYPES.includes(file.type),
     'Please choose .json format files only'
  ),

Found doing it like this works great (:
z.custom<FileList>().superRefine((files, ctx) => {
        if (files.length === 0) {
            ctx.addIssue({
                code: z.ZodIssueCode.custom,
                message: 'File must be provided',
            })
            return false
        }

        if (
            !['image/webp', 'image/png', 'image/svg', 'image/jpg', 'image/jpeg'].includes(
                files[0].type
            )
        ) {
            ctx.addIssue({
                code: z.ZodIssueCode.custom,
                message: 'File must be a valid image type',
            })
            return false
        }

        if (files[0].size > 1024 * 1024 * 5) {
            ctx.addIssue({
                code: z.ZodIssueCode.custom,
                message: 'File must be less than 5MB',
            })
            return false
        }

        return true
    }),

This is not exactly relevant but kind of is... Has anyone found a nice way to handle the fact you wont have a File on the server side validation?
Normally it's simple to share the schema for Client / Server validation.
For File handling on the server, you normally have to stream the file into an upload handler and return it as a string representing the location of the file (Given File doesnt exist server side).
I've previously just made a combination of schemas:
FileFormBaseSchema = Non file inputs

FileFormClientSchema = Base + File inputs as `z.custom<File>`

FileFormServerSchema = Base + File inputs as strings

A Function would be nicer to just pass isServer and switch the specific field but you can't infer the type properly that way.
If anyone has a clean way I'd LOVE to see it 👀

i think what @officialtbabs have suggested is the right approach. your suggestion will work reverse. if you check the doc for refine, it says the second arg in refine is for handling the error. and the error will be produced only if the the function (first arg) returns false
so if we do (files) => files?.[0]?.size >= MAX_FILE_SIZE, it'll return false when the file size is less then MAX_FILE_SIZE. and as per your code, it'll then return the error message saying, "Max file size is 5MB" (which we surely don't want)
Same goes for file?.length

For next.js users who stumble across this because of ReferenceError: File is not defined and only require a basic check, I would suggest this:
const schema = z.custom<File | Buffer>((data) => {
  return typeof window === 'undefined' ? data instanceof Buffer : data instanceof File
}, 'Data is not an instance of a Buffer or File')

Tested it like this in a server component:
    const image = await fetch(
      'https://upload.wikimedia.org/wikipedia/commons/5/50/Adobe_Illustrator_icon.png'
    )
    const blob = await image.blob()
    const arrayBuffer = await blob.arrayBuffer()
    const buffer = Buffer.from(arrayBuffer)

    schema.parse(buffer) as Buffer
    schema.parse({}) // Fails

... and in a client component:
    const image = await fetch(
      'https://upload.wikimedia.org/wikipedia/commons/5/50/Adobe_Illustrator_icon.png'
    )
    const blob = await image.blob()
    const file = new File([blob], 'filename')

    schema.parse(file) as File
    schema.parse({}) // Fails

The type assertions are unfortunately necessary because TS can obviously never know whether the code is on the server or the client.
But if you only need to validate the file on either server or client, you could of course tweak the code accordingly. The only essential thing is the check for window so that on the server, reading File isn't attempted.

Putting this here if anyone still has this problem. The solution that worked for me was this one:
const MAX_FILE_SIZE = 500000;
const ACCEPTED_IMAGE_TYPES = ["image/jpeg", "image/jpg", "image/png", "image/webp"];

const RegistrationSchema = z.object({
  profileImage: z
    .any()
    .refine((files) => files?.length == 1, "Image is required.")
    .refine((files) => files?.[0]?.size <= MAX_FILE_SIZE, `Max file size is 5MB.`)
    .refine(
      (files) => ACCEPTED_IMAGE_TYPES.includes(files?.[0]?.type),
      ".jpg, .jpeg, .png and .webp files are accepted."
    ),
});

No image provided
Too big
Wrong type
All good ✔
Then finally, in the data object we get

500000 means 500 KB, so if you mean 5MB, you coud do 1024 8 1024 * 5

Firstly, I'd like to extend my gratitude for providing detailed information on data validation. It has greatly aided me in my projects.
Having benefitted from the discussions here, I'd like to give back by sharing an observation that might be helpful to others. I noticed that many are using a check with .length to validate if a field has a value, for instance:
.refine((files) => files?.length == 1, "Image is required.")

However, the library offers a more succinct method with .nonempty(). One can simply use:
.nonempty("Please upload a file")

https://zod.dev/?id=nonempty
This approach provides a cleaner way to validate if the field is empty.
Again, thank you for this wonderful library, and I hope this suggestion proves helpful to others!
Best regards,

How can I make it work on next js 13 app directory using shadcn form component?

How can I make it work on next js 13 app directory using shadcn form component?

shadcn already have a well described example for this where they've used react-hook-form with zod. I think that's a very good approach to working with forms. and for validating file inputs, you can try this answer here. it's one of the best possible ways to handle this imo

How can I make it work on next js 13 app directory using shadcn form component?

shadcn already have a well described example for this where they've used react-hook-form with zod. I think that's a very good approach to working with forms. and for validating file inputs, you can try this answer here. it's one of the best possible ways to handle this imo

I read the documentation and tried the approach, it doesn't work, the validation stuck on this part
.refine((files) => files?.length == 1, "Image is required.")
even I attached the file, the error still pop up. And I tried console.log the "files" but it's empty or the file path. I suspect that the input component doesn't return the file object that zod is expected.
I'm sorry if none of these makes any sense, I'm new to react/next js

How can I make it work on next js 13 app directory using shadcn form component?

shadcn already have a well described example for this where they've used react-hook-form with zod. I think that's a very good approach to working with forms. and for validating file inputs, you can try this answer here. it's one of the best possible ways to handle this imo

I read the documentation and tried the approach, it doesn't work, the validation stuck on this part
.refine((files) => files?.length == 1, "Image is required.")
even I attached the file, the error still pop up. And I tried console.log the "files" but it's empty or return the file path. I suspect that the input component doesn't return the file object that zod is expected.
I'm sorry if none of these makes any sense, I'm new to react/next js

Sounds like the error lies in your dom tree and how you're integrating react-hook-form and Zod with your shadcn components for file type input. a simple reproducible example would be helpful to actually help u

@PratikDev hey i have the same issue and i made a demo.
Zod + Shadcn form demo

@PratikDev hey i have the same issue and i made a demo.
Zod + Shadcn form demo

Instead of passing the field prop in your file type input, pass the fileRef we get from form.register("file")
I changed it from
 <Input type="file" accept="application/pdf" {...field} />

to
 <Input type="file" accept="application/pdf" {...fileRef} />

fileRef is coming from
const fileRef = form.register('file', { required: true });

also made the default value of file from an empty string to undefined
Edited Demo

@PratikDev hey i have the same issue and i made a demo.
Zod + Shadcn form demo

Instead of passing the field prop in your file type input, pass the fileRef we get from form.register("file")
I changed it from
 <Input type="file" accept="application/pdf" {...field} />

to
 <Input type="file" accept="application/pdf" {...fileRef} />

fileRef is coming from
const fileRef = form.register('file', { required: true });

also made the default value of file from an empty string to undefined
Edited Demo

@PratikDev i have tried edited demo. now its stuck on this refine 😕
refine((file) => file?.type === 'application/pdf', 'Must be a PDF.')

@Kavindu-Wijesekara it's because file?.type doesn't exist. file is a type of FileList. so you need to do file[0]?.type. The same goes for size. I made the changes. Also removed unused schema to check if the form was submitted successfully. You can check the edited demo

@Kavindu-Wijesekara it's because file?.type doesn't exist. file is a type of FileList. so you need to do file[0]?.type. The same goes for size. I made the changes. Also removed unused schema to check if the form was submitted successfully. You can check the edited demo

@PratikDev Oh i didn't see that. Anyway thank you very much. Now it's working perfectly 👌

Reason and Solution
Hey everyone. I just found it. Using z.instanceof(File) or anything similar throws File is not defined error, because the File class is only available on node-v20.0.0 or upper (related PR). so if your node is lower than this, and you're trying to run the code on the node environment instead of the browser, it'll throw the File is not defined error. The same goes with FileList.
So the solution would be to upgrade your node version to the latest one. and if you cannot afford that, u can try using the @web-std/file library and use the File class they provide

@PratikDev
Hi
console.log(formData.get("videos") instanceof File) // Works
console.log(formData.getAll("videos") instanceof FileList) // Doesn't work

Did you get FileList working yourself?

i'm not sure if FileList is available in NodeJS. i haven't tried it. In my project, I lastly moved file validation out of the Zod schema and did it manually. tho we have some workarounds for it, but it was making it too difficult to maintain as the project grows IMO

If anyone's using z.instanceof approach and having a hard time giving a custom error message to the validation. This approach worked for me.
const ACCEPTED_FILE_TYPES = ['application/json']

z.custom<File>(val => val instanceof File, 'Please upload a file')
  .refine(
    file => ACCEPTED_FILE_TYPES.includes(file.type),
    { message: 'Please choose .json format files only' }
  ),

This works, thanks!

It seems that Blob is equivalent to File for node.js, at least for me, when I use it it passes:
const zBody = z.object({
  file: z.instanceof(Blob),
})

const formData = await request.formData()
const { file } = zBody.parse(Object.fromEntries(formData.entries()))

console.log(file, file instanceof Blob)

/** output:
File {
  size: 1259339,
  type: 'image/jpeg',
  name: 'abdessamadely.jpg',
  lastModified:<PHONE_NUMBER>144
}
true
**/

This is how to handle single or multiple files. 👌
The following example is for images with a maximum size of 4MB :
const ACCEPTED_IMAGE_TYPES = ["image/png", "image/jpg", "image/jpeg"];
const MAX_IMAGE_SIZE = 4; //In MegaBytes

const sizeInMB = (sizeInBytes: number, decimalsNum = 2) => {
  const result = sizeInBytes / (1024 * 1024);
  return +result.toFixed(decimalsNum);
};

const UserGeneralInfoSchema = z.object({
  profileImage: z
    .custom<FileList>()
    .refine((files) => {
      return Array.from(files ?? []).length !== 0;
    }, "Image is required")
    .refine((files) => {
      return Array.from(files ?? []).every(
        (file) => sizeInMB(file.size) <= MAX_IMAGE_SIZE
      );
    }, `The maximum image size is ${MAX_IMAGE_SIZE}MB`)
    .refine((files) => {
      return Array.from(files ?? []).every((file) =>
        ACCEPTED_IMAGE_TYPES.includes(file.type)
      );
    }, "File type is not supported"),
});

For me import File from "buffer" helped, here is my snippet:
`import { File } from "buffer";
const fileSchema = z.instanceof(File, { message: "Required" });
const imageSchema = fileSchema.refine(
(file) => file.size === 0 || file.type.startsWith("image/")
);
const addScheme = z.object({
name: z.string().min(1),
description: z.string().min(1),
priceInCents: z.coerce.number().int().min(1),
file: fileSchema.refine(
(file) => file.size > 0,
"File size was 0, please upload a proper file!"
),
image: imageSchema.refine(
(file) => file.size > 0,
"File size was 0, please upload a proper file!"
),
});`

For me import File from "buffer" helped, here is my snippet:
import { File } from "buffer";

const fileSchema = z.instanceof(File, { message: "Required" });
const imageSchema = fileSchema.refine(
  (file) => file.size === 0 || file.type.startsWith("image/")
);

const addScheme = z.object({
  name: z.string().min(1),
  file: fileSchema.refine(
    (file) => file.size > 0,
    "File size was 0, please upload a proper file!"
  ),
  image: imageSchema.refine(
    (file) => file.size > 0,
    "File size was 0, please upload a proper file!"
  ),
});

This worked for me, thanks.

some quick maths i use
2 ** 18 = 256 MB
2 ** 19 = 512 MB
2 ** 20 = 1 MB
2 ** 21 = 2 MB
2 ** 22 = 4 MB
2 ** 23 = 8 MB
2 ** 24 = 16 MB

Thanks to the other responses in this thread. This worked for me to collect multiple files.
const MAX_FILE_SIZE = 500000;
const ACCEPTED_IMAGE_TYPES = ["image/jpeg", "image/jpg", "image/png", "image/webp"];

const schema = zod.object({
  image: zod
    .instanceof(FileList, { message: "Required" })
    .refine((file) => file?.length > 0, 'A file is required.')
    .refine((files) => {
      for (let i = 0; i < files.length; i++) {
        console.log(i, files[i])
        if (files[i].type in ACCEPTED_IMAGE_TYPES) {
          if (!ACCEPTED_IMAGE_TYPES.includes(files[i].type)) return false; // Check if it's an accepted image type
        }
      }
      return true;
    }, 'Must be a valid image.')
    .refine((files) => {
      for (let i = 0; i < files.length; i++) {
        if (files[i].size > MAX_FILE_SIZE) return false; // Check if size exceeds max size
      }
      return true;
    }, 'Max size reached.')
});

.......

              <Controller
                control={control}
                name="image"
                render={({ field: { value, onChange, ...field } }) => (
                  <FormControl error={Boolean(errors.lensUrl)} fullWidth>
                    <InputLabel required>Superpower card image</InputLabel>
                    <input
                      type="file"
                      accept={ACCEPTED_IMAGE_TYPES.join(', ')}
                      //multiple
                      maxLength={MAX_FILE_SIZE}
                      onChange={(event) => onChange(event.target.files || "")}
                      {...field}
                    />

                    {errors.image ? <FormHelperText>{errors.image.message}</FormHelperText> : null}
                  </FormControl>
                )}

Can someone explain to me what is wrong with this code?
const SUPPORTED_IMAGE_TYPES = [
  "image/jpeg",
  "image/jpg",
  "image/png",
  "image/webp",
];

export const signUpValidation = z
  .object({
    name: personalValidation("Name"),
    lastName: personalValidation("Last name"),
    avatar: z.instanceof(File).optional(),
    email: emailValidation,
    password: validatePassword,
    passwordRepeat: validatePassword,
    country: z.string().min(1),
    city: z.string().min(1),
    postalCode: z.string().min(1),
  })
  .refine((data) => data.password === data.passwordRepeat, {
    message: "Passwords are not the same",
    path: ["passwordRepeat"],
  })
  .refine(
    (data) => data.avatar && SUPPORTED_IMAGE_TYPES.includes(data.avatar.type),
    ".jpg, .jpeg, .png and .webp files are accepted."
  );

All fields work as I wanted except 'Avatar'.
The error Im getting "Input not instance of File"

It is so complicated to only validate multiple files, is there a way to simplify this?

Becareful of using .custom<FileList>() and Array validation, looks like it's not works when you upload one file.

FileList didn't work as expected for me, but using Blob as an alternative was working fine.
export const PostUploadFileSchema = z
  .object({
    "image[]": z
      .custom<Blob>()
      .refine(
        (blob) => {
          return blob.size <= MAX_FILE_SIZE;
        },
        {
          message: `More than ${MAX_FILE_SIZE} are not allowed`,
        }
      )
      .refine((blob) => ACCEPTED_IMAGE_TYPES.includes(blob?.type), {
        message: "Only .jpg, .jpeg, .png and .webp formats are supported.",
      }),
  })
  .openapi("Post Upload File");

 // To convert Blob to File
 for (let image of images) {
  image = new File([image], image.name, {
    type: image.type,
  });

  if (image instanceof File) {
    await uploadFile(image);
  }
}

@HARAJLI98 yep still getting errors, I think we'll just have to use the z. any

didn't know that "any" could solve my problem, thank you 👍

Nuxt 3 /server :
export const schema = z.object({
  email: z.string().email(),
  fund: z.number(),
  first_name: z.string(),
  last_name: z.string(),
  subscription_form: z.object({
    filename: z.string(),
    type: z.string().refine(type => type === 'application/pdf', 'Only PDF files are accepted.'),
    data: z.instanceof(Buffer)
  })
})

  const email = form.find(field => field.name === 'email')?.data.toString()
  const firstName = form.find(field => field.name === 'first_name')?.data.toString()
  const lastName = form.find(field => field.name === 'last_name')?.data.toString()
  const fund = form.find(field => field.name === 'fund')?.data.toString()
  const subscriptionForm = form.find(field => field.name === 'subscription_form')

  const formData = {
    email,
    fund: Number(fund),
    first_name: firstName,
    last_name: lastName,
    subscription_form: {
      filename: subscriptionForm.filename,
      type: subscriptionForm.type,
      data: subscriptionForm.data
    }
  }

    const validationResult = schema.safeParse(formData)

  if (!validationResult.success) {
    throw createError({
      statusCode: 400,
      statusMessage: 'Validation Error',
      data: validationResult.error.errors
    })
  }

Putting this here if anyone still has this problem. The solution that worked for me was this one:
const MAX_FILE_SIZE = 500000;
const ACCEPTED_IMAGE_TYPES = ["image/jpeg", "image/jpg", "image/png", "image/webp"];

const RegistrationSchema = z.object({
  profileImage: z
    .any()
    .refine((files) => files?.length == 1, "Image is required.")
    .refine((files) => files?.[0]?.size <= MAX_FILE_SIZE, `Max file size is 5MB.`)
    .refine(
      (files) => ACCEPTED_IMAGE_TYPES.includes(files?.[0]?.type),
      ".jpg, .jpeg, .png and .webp files are accepted."
    ),
});

No image provided
Too big
Wrong type
All good ✔
Then finally, in the data object we get
const MAX_FILE_SIZE = 510241024
const ACCEPTED_IMAGE_TYPES = [
'image/jpeg',
'image/jpg',
'image/png',
'image/webp',
]
CertificateFile: z.any().optional()
.refine(file => file.length == 1 ? ACCEPTED_FILE_TYPES.includes(file?.[0]?.type) ? true : false : true, 'Invalid file. choose either JPEG ,jpg , webp PNG image')
.refine(file => file.length == 1 ? file[0]?.size <= MAX_FILE_SIZE ? true : false : true, 'Max file size allowed is 5MB.'),
})

`const MAX_FILE_SIZE = 510241024
const ACCEPTED_IMAGE_TYPES = [
'image/jpeg',
'image/jpg',
'image/png',
'image/webp',
]
export const PostUploadFileSchema =z.object({
images:z.any().z.optional().refine(file => file.length == 1 ? ACCEPTED_FILE_TYPES.includes(file?.[0]?.type) ? true : false : true, 'Invalid file. choose either JPEG ,jpg , webp PNG image')
.refine(file => file.length == 1 ? file[0]?.size <= MAX_FILE_SIZE ? true : false : true, 'Max file size allowed is 5MB.'),
})
use this
`

If image is optional:
avatar: z.custom<File | undefined>()
.refine(file => !file || file?.size <= MAX_FILE_SIZE, {message: "Max image size is 5MB."})
.refine(file => !file || ACCEPTED_IMAGE_TYPES.includes(file?.type),
".jpg, .jpeg, .png, .webp, files are accepted only",
),

@wassim is this a File instance? If so just use z.instanceof(File). Though there's no length property on the File class: https://developer.mozilla.org/en-US/docs/Web/API/File

When i do that, i have this error : { membersFile: [ 'Input not instance of File2' ] }

If anyone is working with shadcn-ui form components  and is trying to validate the schema via zod, you can refer the following article.
TLDR; if you are working on client components in next.js change your schema to
const formSchema = z.object({
  file: z.instanceof(FileList).optional(),
});

When defining the form
const form = useForm<z.infer<typeof formSchema>>({
    resolver: zodResolver(formSchema),
});
const fileRef = form.register("file");

Then later when rendering the component
<Input type="file" placeholder="shadcn" {...fileRef} />

If anyone is working with shadcn-ui form components and is trying to validate the schema via zod, you can refer the following article.
TLDR; if you are working on client components in next.js change your schema to
const formSchema = z.object({
  file: z.instanceof(FileList).optional(),
});

When defining the form
const form = useForm<z.infer<typeof formSchema>>({
    resolver: zodResolver(formSchema),
});
const fileRef = form.register("file");

Then later when rendering the component
<Input type="file" placeholder="shadcn" {...fileRef} />

so want to be optional ?
const MAX_FILE_SIZE = 5*1024*1024
const ACCEPTED_IMAGE_TYPES = [
'image/jpeg',
'image/jpg',
'image/png',
'image/webp',
]
export const PostUploadFileSchema =z.object({
images:z.any().z.optional().refine(file => file.length == 1 ? ACCEPTED_FILE_TYPES.includes(file?.[0]?.type) ? true : false : true, 'Invalid file. choose either JPEG ,jpg , webp PNG image')
.refine(file => file.length == 1 ? file[0]?.size <= MAX_FILE_SIZE ? true : false : true, 'Max file size allowed is 5MB.'),
})

if want to limit the size  510241024 is 5mb if you don't want to limit the size remove that one
const ACCEPTED_IMAGE_TYPES = [
'image/jpeg',
'image/jpg',
'image/png',
'image/webp',
]
export const PostUploadFileSchema =z.object({
images:z.any().z.optional().refine(file => file.length == 1 ? ACCEPTED_FILE_TYPES.includes(file?.[0]?.type) ? true : false : true, 'Invalid file. choose either JPEG ,jpg , webp PNG image')

})

###so you want optional
use the above one
use Shadcn ui form
import {
  Form,
  FormControl,
  FormField,
  FormItem,
  FormLabel,
  FormMessage,
  FormDescription,
} from "@/components/ui/form";
<Form {...form}>
<form >
 <FormField
          control={form.control}
          name="name"
          render={({ field }) => (
            <FormItem>
              <FormLabel>File</FormLabel>
              <FormControl>
             <Input type="file" placeholder="shadcn" {...field } />
              </FormControl>
              <FormMessage />
            </FormItem>
          )}
        />

</form>
</Form>

it will work if you don't understand  message me

here's an  alternative to handle single or multiple files on both browser and server:
const Schema= z.object({
  files: z
    .preprocess(
        (value) => (Array.isArray(value) ? value : [value]),
      z.array(z.instanceof(File))
    )
    // ...
});

If anyone is working with shadcn-ui form components and is trying to validate the schema via zod, you can refer the following article.
TLDR; if you are working on client components in next.js change your schema to
const formSchema = z.object({
  file: z.instanceof(FileList).optional(),
});

When defining the form
const form = useForm<z.infer<typeof formSchema>>({
    resolver: zodResolver(formSchema),
});
const fileRef = form.register("file");

Then later when rendering the component
<Input type="file" placeholder="shadcn" {...fileRef} />

This gives me the following error when I deploy on Vercel.

Error occurred prerendering page "/dashboard/files/upload". Read more: https://nextjs.org/docs/messages/prerender-error
ReferenceError: FileList is not defined

If anyone is working with shadcn-ui form components and is trying to validate the schema via zod, you can refer the following article.
TLDR; if you are working on client components in next.js change your schema to
const formSchema = z.object({
  file: z.instanceof(FileList).optional(),
});

When defining the form
const form = useForm<z.infer<typeof formSchema>>({
    resolver: zodResolver(formSchema),
});
const fileRef = form.register("file");

Then later when rendering the component
<Input type="file" placeholder="shadcn" {...fileRef} />

This gives me the following error when I deploy on Vercel.

Error occurred prerendering page "/dashboard/files/upload". Read more: https://nextjs.org/docs/messages/prerender-error
ReferenceError: FileList is not defined

Fixed it with this from the originally referenced issue.
file: typeof window === 'undefined' ? z.any() : z.instanceof(FileList)


Usage Tagged (safe) types in CoreData

Hi @helje5
Thank you for quick solve previous issue
I use Tagged
Tagged structure also have Codable protocol realisation like RawValue type
Example
struct AccessTokenTagged {}
typealias AccessToken = Tagged<AccessTokenTagged, String>

@Model
final class StoredAccess: NSManagedObject {
    var token: AccessToken
    ...
}

When compilation as result we can see
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unacceptable type of value for attribute: property = "token"; desired type = NSString; given type = _TtGC13ManagedModels10CodableBoxGV6Tagged6TaggedV5WE_UC17AccessTokenTaggedSS__; value = <_TtGC13ManagedModels10CodableBoxGV6Tagged6TaggedV5WE_UC17AccessTokenTaggedSS__: 0x600000336460>.'

It's strange, because ManagedModels use CodableBox for wrap Codable types. How we can solve it issue in current realisation?

Can't look into that right away, but RawValue properties are not supposed to be treated as Codable's. Instead they should just store as their rawValue (e.g. String in this case).

@helje5

Can't look into that right away, but RawValue properties are not supposed to be treated as Codable's. Instead they should just store as their rawValue (e.g. String in this case).

Tagged supports both protocols RawRepresentable and Codable
Anyway it must works fine? Or I must add additional ValueTransformer?

Same troubles when trying usage case types
enum AccessLevel: String, Codable {
    case selfOnly = "selfonly"
    case master
    case technical
    case financial
}

@Model
final class StoredAccess: NSManagedObject {
    var accessLevel: AccessLevel
    ...
}

Crash
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unacceptable type of value for attribute: property = "accessLevel"; desired type = NSString; given type = _TtGC13ManagedModels10CodableBoxO5WE_UC11AccessLevel_; value = <_TtGC13ManagedModels10CodableBoxO5WE_UC11AccessLevel_: 0x600000030840>.'

Hm, weird. That is pretty much the same I'm doing in the sample app. Though maybe not Codable, that might interfere, need to check.

I'm some change init code and now have new console crash with fatalError
ManagedModels/PersistentModel+KVC.swift:249: Fatal error: No box found for non-optional Codable value for key token?

I pushed a fix for Codable+RawRepresentable properties to develop, but I didn't try the Tagged thing.

Also did a quick test w/ Tagged, seems to work.

@helje5 Have new error
Could not cast value of type 'Swift.Optional<Any>' (0x1f624fc18) to 'Swift.String' (0x1f6248898).

in PersistentModel+KVC.swift

With the 'develop' branch?

With the 'develop' branch?

yes

Can you produce a mini-project that reproduces that? All tests run through and I tried w/ the demo app w/ success.


[CARBONDATA-3927]Remove compressor name from tupleID to make it short to improve store size and performance.

Why is this PR needed?
Currently, we store the tupleId which is very long, which increases the store size and reduces query performance.
What changes were proposed in this PR?
Remove the compressor name from the tupleID. This helps to improve the store size and improve the query performance also.
Does this PR introduce any user interface change?

No

Is any new testcase added?

No, existing test cases will take care.

Build Failed  with Spark 2.4.5, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbon_PR_Builder_2.4.5/1617/

Build Failed  with Spark 2.3.4, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbonPRBuilder2.3/3358/

retest this please

Build Failed  with Spark 2.4.5, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbon_PR_Builder_2.4.5/1632/

Build Failed  with Spark 2.3.4, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbonPRBuilder2.3/3373/

Build Failed  with Spark 2.3.4, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbonPRBuilder2.3/3378/

Build Failed  with Spark 2.4.5, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbon_PR_Builder_2.4.5/1637/

retest this please

Build Failed  with Spark 2.3.4, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbonPRBuilder2.3/3501/

Build Failed  with Spark 2.4.5, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbon_PR_Builder_2.4.5/1759/

Build Success with Spark 2.4.5, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbon_PR_Builder_2.4.5/1762/

Build Success with Spark 2.3.4, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbonPRBuilder2.3/3504/

retest this please

Build Success with Spark 2.3.4, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbonPRBuilder2.3/3590/

Build Success with Spark 2.4.5, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbon_PR_Builder_2.4.5/1851/

Build Failed  with Spark 2.3.4, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbonPRBuilder2.3/3711/

Build Failed  with Spark 2.4.5, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbon_PR_Builder_2.4.5/1972/

@kunal642 added test case, please review

Build Success with Spark 2.3.4, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbonPRBuilder2.3/3726/

Build Success with Spark 2.4.5, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbon_PR_Builder_2.4.5/1987/

retest this please

Build Success with Spark 2.4.5, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbon_PR_Builder_2.4.5/2010/

Build Success with Spark 2.3.4, Please check CI http://<IP_ADDRESS>:12545/job/ApacheCarbonPRBuilder2.3/3751/

LGTM


Enhancement to List images

Hi there,
Is it possible to have the following features to the List Images?

Pagination
Limit
Randomize List

Currently it's fetching all of photo list.

This would be great. Also it would be nice if we could get the source.unsplash.com/{photo_id} url as well.

@jskrzypek There's already way to get a specific photo, simply add the query parameter ?image={id} to the URL (https://unsplash.it/200/200?image=2)

@DMarby, sure for one photo that works. But I want to get a list of photos where one of the fields is a direct link to a photo. I want to be able to pass the list to something that can use the metadata and the url without having to apply a transform on the url.

@DMarby where can I find the ID the photos ?
For instance, https://unsplash.com/photos/EeEx8zpOESA
Is the only possible way to go trough the entire list : https://unsplash.it/images and find the corresponding number?
I think it would be amazing to look by its slug aswell, once we find it on unsplash?

@DMarby any chance for at least a limit?
Would be happy to send a PR, if you're open for that? :)

Sorry for the super late response to this.
It sounds like a great idea to add pagination + limits, as well as directly linking to the photo rather than needing to transform it.
Will make sure that this gets into the API during the current rewrite.

I've added a new list endpoint that has pagination, limits, and contains a field called download_url for getting a direct link to the full-sized image.
It can be found on https://picsum.photos/v2/list. For more info on how to use it, see https://picsum.photos


Add location tables

This adds the schema, models, and helper functions for adding, fetching, updating, and deleting locations and their properties from the database. These are associated together with the location_id.

Closing due to decision to refactor DB. Will re-open as a separate PR when implemented using the new pattern.


add certs back

Feature or Problem
Need to run CA Certs update for wadm to work with NGS
I dont have docker on this machine, so im letting CI sanity check it

This should work brooks


Cypress specs for organizations settings

Notion card
Summary
Cypress specs for updating the organization settings including validation errors

User should be able to update the company name
The company name cannot be blank.
The admin & owner should be able to update the address.
The admin & owner should be able to update the business phone number and the phone number cannot be blank
Admin owner should be able to select the country, and base currency and enter the standard rate, timezone, date format
and fiscal year-end
The admin and owner should be able to upload a company logo
The admin and owner should be able to delete the company logo
The admin and owner should be able to delete and upload another logo.
On clicking update, the values of the change should be updated and a toast message should be displayed.

Preview

Type of change
Please delete options that are not relevant.

[ ] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to
not work as expected)
[ ] This change requires a documentation update

How Has This Been Tested?

Checklist:

[ ] I have manually tested all workflows
[ ] I have performed a self-review of my own code
[ ] I have added automated tests for my code

@apoorv1316  Ci checks are failing. please check and then merge.

@apoorv1316 Ci checks are failing. please check and then merge.

Hey, CI Checks failing because of new data-cy elements added in the PR, and also the PR for [buildlkite] (https://github.com/saeloun/miru-web/pull/836) is not merged.


Foundation is not compatible with Cloud Zoom

Hi.
Cloud Zoom does not work with the Foundation
https://github.com/sos4nt/cloud-zoom/wiki/Cloud-Zoom
You can consult a similar plug-in that works with the Foundation?
Thanks.

While I haven't used that plugin before, what doesn't work?
In some cases one must override Foundations max-width. Foundation has this in their code:
img {
max-width: 100%;
height: auto; }
Which I then override in my CSS using this:
.container-for-plugin img{
	max-width:none;
}

Hope this helps!

Thanks for the answer!
Unfortunately does not work.
Here is an example of two pages.
Without using the Foundation, there is a plugin works:
http://soberisy.ru/nofoundation/
At Foundation. The plugin does not work:
http://soberisy.ru/foundation/
Possible conflict with the version of Jquery?

This seems to be a jQuery version issue.
"jQuery 2.x has the same API as jQuery 1.x, but does not support Internet Explorer 6, 7, or 8."

The Foundation forum would be a great place to seek some help with troubleshooting what might be going on here. If it turns out to be a defect, you'll have some more info to provide here which will help prioritize and get it fixed.
We're trying to keep the issue list focused on confirmed defects in Foundation, so any help everyone can provide to differentiate between usage / troubleshooting and actual defects is appreciated!


Convert longer media varchar fields to text in the catalog database

Description

Related #4279, see that issue for the rationale.
Alter the audio and image tables in the catalog to convert the following fields from character varying to text in the underlying database:

foreign_identifier
foreign_landing_url
url
thumbnail
creator
creator_url
title
audio_set_foreign_identifier (audio only)

This will require crafting the migration steps for the catalog database by hand and applying them, then altering the SQL DDL for the tables to reflect this difference. The alters should look like this:
ALTER TABLE audio ALTER COLUMN title TYPE TEXT USING title :: TEXT;

Postgres uses the same underlying storage methods for both these types, so the conversion from one to the other should be extremely fast.

Note
This is blocked by #4311, as the target columns need to be expanded first before the source ones can, otherwise the data refresh will fail.

@WordPress/openverse-catalog is anyone able to write the migration for this?

I'll pick this up later this week if no one gets to it before me.


Adding user for automated scripts

Hey,
I am doing some automated database maintenance where objects are created, edited, deleted by a script. When the script is executed it shows system  as a user. Since I have several independent scripts, I would like to give them a "name" so I can sort and work with auditing logs better rather than just be stuck with a system.  as a generic term.
What would be the approach to do it that?

My approach to this is to always store the name of the calling program in the "additional_data" field using get_additional_data().  However that does not allow search/filter through the admin interface but its enough for my needs.
I do it like this:
def get_exec_context():
import sys
env={}
if len(sys.argv)>0:
env['prog']=sys.argv[0]
if len(sys.argv)>1:
env['param1']=sys.argv[1]
if len(sys.argv)>1:
env['param_rest']=" ".join(sys.argv[2:])
return env
class AuditedClass:
# additional auditlog data
def get_additional_data(self):
    ....
    return {'exec': get_exec_context(),'uuids':...  }

Awesome, that is an elegant soliution.

@Northshoot if satisfied would you close this issue?  Thanks!


Move common meta types into dedicated 'meta' API group

What this PR does / why we need it:
Creates a meta/v1 API group that contains some shared/common types that will be reused between the different API groups (i.e. acme, vault etc).
This PR is based on #2087
Release note:
NONE

/hold

/retest

Passing!
/assign @JoshVanL

/lgtm

/hold cancel


bin/watch-storefront.sh webpack-dev-server: not found

Describe the bug

bin/watch-storefront.sh is working tho.
When I log in to the container and do a npm i I can run bin/watch-administration.sh.
To Reproduce
Steps to reproduce the behavior:

Open CLI from the container
Run bin/watch-administration.sh

Expected behavior
Admin watcher is starting without problems.
Environment:

OS: [e.g. Ubuntu 20.04] WSL2 Ubuntu 20.04 with docker image shyim/shopware:6.4.11-php8.0
Docker Version: 4.9.1

It should install them with that script here https://github.com/shopware/production/blob/6.4/bin/build-administration.sh#L49


brew-pkg failing

It seems to fail, maybe it is because brew is too new and for brew pkg command, maybe we need to fork it and update it, or implement it by ourselves, or maybe it is a simpler bug, I haven't checked it.
+ brew pkg --with-deps --without-kegs metacall
==> Creating package staging root using Homebrew prefix /opt/homebrew
Error: undefined method `exists?' for class File
Error: undefined method `exists?' for class File
==> Staging formula metacall
/opt/homebrew/bin/brew-pkg.rb:74:in `block in pkg'
/opt/homebrew/bin/brew-pkg.rb:65:in `each'
/opt/homebrew/bin/brew-pkg.rb:65:in `pkg'
/opt/homebrew/bin/brew-pkg.rb:162:in `<top (required)>'
<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.2/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.2/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/opt/homebrew/Library/Homebrew/extend/kernel.rb:10:in `require?'
/opt/homebrew/Library/Homebrew/brew.rb:97:in `<main>'
You have disabled automatic updates and have not updated today.
Do not report this issue until you've run `brew update` and tried again.

https://github.com/metacall/distributable-macos/actions/runs/9556194327/job/26342635930

It seems to fail, maybe it is because brew is too new and for brew pkg command, maybe we need to fork it and update it, or implement it by ourselves, or maybe it is a simpler bug, I haven't checked it.
+ brew pkg --with-deps --without-kegs metacall
==> Creating package staging root using Homebrew prefix /opt/homebrew
Error: undefined method `exists?' for class File
Error: undefined method `exists?' for class File
==> Staging formula metacall
/opt/homebrew/bin/brew-pkg.rb:74:in `block in pkg'
/opt/homebrew/bin/brew-pkg.rb:65:in `each'
/opt/homebrew/bin/brew-pkg.rb:65:in `pkg'
/opt/homebrew/bin/brew-pkg.rb:162:in `<top (required)>'
<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.2/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.2/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/opt/homebrew/Library/Homebrew/extend/kernel.rb:10:in `require?'
/opt/homebrew/Library/Homebrew/brew.rb:97:in `<main>'
You have disabled automatic updates and have not updated today.
Do not report this issue until you've run `brew update` and tried again.

https://github.com/metacall/distributable-macos/actions/runs/9556194327/job/26342635930

@FirePing32

Will look into it.


Switch npx to be code-group with npx, pnpm dlx and bunx in upgrade.md

🔗 Linked issue

Fixes on instance of #27790
📚 Description

Improves documentation for users not using npm by allowing them to copy and past the commands from the upgrade page using their preferred package manager.

I just noticed my prettier config went and changed alot of stuff

Perhaps it'd be better to use the package manager components from UnDocs?

Thank you! ❤


the timing of the angular velocity update process is slow when there is no IMU data

This is my first post.
Forgive me if I make you feel bad by using incorrect words in English, i don't mean it at all.
I think there is a problem with the posture calculation without IMU data.
I think the timing of the angular velocity update process is slow when there is no IMU data.
Therefore, the posture used when calculating the amount of rotation by the ExtrapolateRotation
when estimating the posture of the PoseExtrapolator is the posture of the previous time and
the posture of the previous time, and there is one tempo delay.
Specifically, the code is as follows:.
cartographer\mapping\pose_extrapolator.cc
Original：line 200
    // There is no IMU data until 'time', so we advance the ImuTracker and use     // the angular velocities from poses and fake gravity to help 2D stability.     imu_tracker->Advance(time);     imu_tracker->AddImuLinearAccelerationObservation(Eigen::Vector3d::UnitZ());     imu_tracker->AddImuAngularVelocityObservation(         odometry_data_.size() < 2 ? angular_velocity_from_poses_                                   : angular_velocity_from_odometry_);
Modified
    // There is no IMU data until 'time', so we advance the ImuTracker and use     // the angular velocities from poses and fake gravity to help 2D stability.     imu_tracker->AddImuAngularVelocityObservation(         odometry_data_.size() < 2 ? angular_velocity_from_poses_                                   : angular_velocity_from_odometry_);     imu_tracker->Advance(time);     imu_tracker->AddImuLinearAccelerationObservation(Eigen::Vector3d::UnitZ());
The reason for this is:
In the process of "AddImuAngularVelocityObservation", the angular velocity is updated.
In the original code,
    imu_tracker->Advance(time);     imu_tracker->AddImuLinearAccelerationObservation(Eigen::Vector3d::UnitZ());
The posture calculation uses the previous angular velocity, rather than the most
recent angular velocity it wanted to use.
Therefore, when calculating the amount of rotation in ExtrapolateRotation,
This posture - What we want to do in the previous posture is the previous
posture and the previous posture.
By making the above corrections,
Specifies the angular velocity updated in "AddImuAngularVelocityObservation"
so the current and previous postures are used to calculate the amount of
rotation in ExtrapolateRotation.
Please kindly consider this matter.

Was the English explanation insufficient?
Or should I report a more detailed explanation of the problem?
If you have any problems with this issue, please let us know.


Failed to connect

Thank you for building this!!!  I have been using WaterGuru for several years and have been looking for a way to integrate it with Home Assistant.  I tried to get WaterGuru-API to work in Docker with little success.  I tried your integration and, with one minor exception, get it up and running easily.  The only issue I had is that the email address needs to be enter in all lower case; my email contains several words so I usual use Camel case.  Since I have had this same issue with other integration, I was able to get this sorted pretty quickly.
Thank you again for porting WaterGuru-API to HACS.

I addressed the lowercase email in https://github.com/dwradcliffe/home-assistant-waterguru/commit/de757e89780c1d5db941970da2ef8be57ff4a43d


Placeholder is  missing in the Sign in form

In the sign-in form the placeholder for email is missing, I want to work on this issue. kindly assign me this issue

I would like to work in this issue under GSSOC'23. Please assign me this issue.


Add ForceUpdate to TaskSpec

The ForceUpdate parameter is missing from TaskSpec. It'd be useful to rebalance a service.
From the doc : ForceUpdate is a counter that triggers an update even if no relevant parameters have been changed
This should be equivalent to the command line :
docker service update --force service_name

Thanks for reporting. PRs welcome.

Hi @naku ,
Since this project went on mature status, please re-open this issue (if it still stands) to https://github.com/dmandalidis/docker-client. Thanks


Add java source code

Please add java language source code. I can not follow along the codelab in kotlin.🙏

The Paging 3 documentation has code snippets in Java as well.
We won't create the Java version of this codelab.


Can not connect

How do I connect with friends?
If I Click on "As Server" in the main.py programm it will automaticly use my local adress.
When the second party tried to connect to me he gets the following message
"creating a clientInstance connecting to <IP_ADDRESS> TCP Port52596* waiting for connection confirmation."
*we tired the standard one and the TCP Port shown when I Start the server (5 digit)
but I can not confirm him.
When I try to open a headless server this error occures:

C:\Users\andre\Documents\Assetto Corsa Competizione\PyAccEngineer_1_5_7>python headless_server.py
Unhandled error in Deferred:
Traceback (most recent call last):
File "C:...\headless_server.py", line 66, in
headless(sys.argv)
File "C:...\headless_server.py", line 55, in headless
ServerInstance(tcp_port, udp_port)
File "C:...\Server.py", line 256, in init
self.tcp_endpoint.listen(TCP_Factory(self.data_queue))
File "C:...\Python39\site-packages\twisted\internet\endpoints.py", line 511, in listen
return defer.execute(
---  ---
File "C:...\Python39\site-packages\twisted\internet\defer.py", line 164, in execute
result = callable(*args, **kwargs)
File "C:...\Python39\site-packages\twisted\internet\posixbase.py", line 568, in listenTCP
p.startListening()
File "C:...\Python39\site-packages\twisted\internet\tcp.py", line 1335, in startListening
raise CannotListenError(self.interface, self.port, le)
twisted.internet.error.CannotListenError: Couldn't listen on any:4269: [WinError 10048] Normalerweise darf jede Socketadresse (Protokoll, Netzwerkadresse oder Anschluss) nur jeweils einmal verwendet werden.
12:13:39.202 | root | Running as headless server with port TCP:4269 UDP:4270

what are we doing wrong?

did you open the port on the router ?

Idk why I never get notification for issue sry for being 15 days late 😅
Second error is normal if you already have a server open
First sound like a port forwarding issue on the router

did you open the port on the router ?
No, I wasn`t sure about this.
Which port should I open?
"Port52596" which was shown in the error or just the standardports which are selected in the Connection Page?
I never needed to open ports in the router before. Some other drivers had simmilar problems.
I guess adding some words to the readme would be helpfull here ;)
I will test it this week and give you a feedback)

yeah server owner open port 4269 in TCP and 4270 in UDP
or 4269 on both protocol