Skip to content

Commit

Permalink
interface: allow hyphens in interface_name
Browse files Browse the repository at this point in the history
Allow hyphens in interface_name. Both the top level domain and the last
domain component must not contain hyphens.

Fix #7

Signed-off-by: Mattia Mazzucato <mattia.mazzucato@ispirata.com>
  • Loading branch information
matt-mazzucato committed Jan 15, 2020
1 parent 79bc352 commit 7e1c797
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.11.0-beta.2] - Unreleased
### Changed
- Restrict the use of `*` as `interface_name` only to `incoming_data` data triggers.
- Allow hyphens in `interface_name`. Both the top level domain and the last domain component
must not contain hyphens. ([#7](https://github.com/astarte-platform/astarte_core/issues/7))

### Fixed
- Handle empty `bson_value` in `Triggers.SimpleEvents.Encoder`, avoiding crashes when an empty bson
Expand Down
2 changes: 1 addition & 1 deletion lib/astarte_core/interface.ex
Expand Up @@ -94,7 +94,7 @@ defmodule Astarte.Core.Interface do
end

def interface_name_regex do
~r/^[a-zA-Z]+(\.[a-zA-Z0-9]+)*$/
~r/^([a-zA-Z][a-zA-Z0-9]*\.([a-zA-Z0-9][a-zA-Z0-9-]*\.)*)?[a-zA-Z][a-zA-Z0-9]*$/
end

defp handle_legacy_ownership(changeset) do
Expand Down

0 comments on commit 7e1c797

Please sign in to comment.