Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:only support http/https to convert,disabled to reach file system.
- Loading branch information
nick
committed
Sep 8, 2021
1 parent
8126fb6
commit fffe90b
Showing
8 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# check list | ||
- common/const.go Version | ||
- CHANGELOG.md | ||
- Makefile | ||
- merge branch | ||
- docker build and push to docker hub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package common | ||
|
||
//Version Version | ||
const Version = "0.3.0" | ||
const Version = "0.3.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package middleware | ||
|
||
import ( | ||
"net/url" | ||
|
||
"github.com/kataras/iris/v12" | ||
"github.com/lampnick/doctron/common" | ||
) | ||
|
||
func CheckParams(ctx iris.Context) { | ||
webUrl := ctx.URLParam("url") | ||
if webUrl == "" { | ||
outputDTO := common.NewDefaultOutputDTO(nil) | ||
outputDTO.Code = common.InvalidUrl | ||
_, _ = common.NewJsonOutput(ctx, outputDTO) | ||
return | ||
} | ||
|
||
u, err := url.Parse(webUrl) | ||
if err != nil { | ||
outputDTO := common.NewDefaultOutputDTO(nil) | ||
outputDTO.Code = common.InvalidUrl | ||
outputDTO.Message = err.Error() | ||
_, _ = common.NewJsonOutput(ctx, outputDTO) | ||
return | ||
} | ||
|
||
if u.Scheme != "http" && u.Scheme != "https" { | ||
outputDTO := common.NewDefaultOutputDTO(nil) | ||
outputDTO.Code = common.InvalidUrlScheme | ||
_, _ = common.NewJsonOutput(ctx, outputDTO) | ||
return | ||
} | ||
|
||
ctx.Next() | ||
} |