Azure / Azure/bicep

Unable to load files content in the loop

Open
#18,916 2 comments 1 reaction 0 assignees View on GitHub
Needs: Upvote Quality Sprint type system
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 2h
Merged PRs (30d)
79

Description

**Bicep version**
v0.40.2

**Describe the bug**
When try to list files and load content in the loop it works properly when there is only one file in directory as on screen:
Image

Unfortunately, when we have more files same script does not work:
Image

**To Reproduce**
```
//List files
var files = loadDirectoryFileInfo('./Files')

//Map and load file contents
var mapppedFiles = [for item in files:{
fileName: item.baseName
content: loadTextContent(item.relativePath)
}
]

//Output the array of file contents
output fileContents array = mapppedFiles
```

**Additional context**
Need to load all files from directory.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the shown loadDirectoryFileInfo and loadTextContent loop, comparing the one-file and multi-file cases. Trace the handling of these load functions and their relativePath values; done means the example loads and outputs content for every file in the directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.